ni.datastore 0.1.0.dev6 #7
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Publish ni.datastore | |
| on: | |
| release: | |
| types: [published] | |
| workflow_dispatch: | |
| inputs: | |
| environment: | |
| description: The environment to publish to. | |
| default: 'none' | |
| required: true | |
| type: choice | |
| options: | |
| - none | |
| - pypi | |
| - testpypi | |
| env: | |
| dist-artifact-name: ni.datastore-distribution-packages | |
| environment: ${{ github.event_name == 'release' && 'pypi' || inputs.environment }} | |
| environment-info: | | |
| { | |
| "pypi": { | |
| "base-url": "https://pypi.org", | |
| "upload-url": "https://upload.pypi.org/legacy/" | |
| }, | |
| "testpypi": { | |
| "base-url": "https://test.pypi.org", | |
| "upload-url": "https://test.pypi.org/legacy/" | |
| } | |
| } | |
| jobs: | |
| check_ni_datastore: | |
| name: Check ni.datastore | |
| uses: ./.github/workflows/check_ni_datastore.yml | |
| check_docs: | |
| name: Check docs | |
| uses: ./.github/workflows/check_docs.yml | |
| build_ni_datastore: | |
| name: Build ni.datastore | |
| runs-on: ubuntu-latest | |
| needs: [check_ni_datastore, check_docs] | |
| steps: | |
| - name: Check out repo | |
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| - name: Set up Python | |
| uses: ni/python-actions/setup-python@9768589f3e50672173dad75a6fc181e4a85d33fa # v0.7.0 | |
| - name: Set up Poetry | |
| uses: ni/python-actions/setup-poetry@9768589f3e50672173dad75a6fc181e4a85d33fa # v0.7.0 | |
| - name: Check project version | |
| if: github.event_name == 'release' | |
| uses: ni/python-actions/check-project-version@9768589f3e50672173dad75a6fc181e4a85d33fa # v0.7.0 | |
| - name: Build distribution packages | |
| run: poetry build | |
| - name: Upload build artifacts | |
| uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0 | |
| with: | |
| name: ${{ env.dist-artifact-name }} | |
| path: dist/* | |
| publish_to_pypi: | |
| name: Publish ni.datastore to PyPI | |
| if: github.event_name == 'release' || inputs.environment != 'none' | |
| runs-on: ubuntu-latest | |
| needs: [build_ni_datastore] | |
| environment: | |
| # This logic is duplicated because `name` doesn't support the `env` context. | |
| name: ${{ github.event_name == 'release' && 'pypi' || inputs.environment }} | |
| url: ${{ fromJson(env.environment-info)[env.environment].base-url }}/p/ni.datastore | |
| permissions: | |
| id-token: write | |
| steps: | |
| - name: Download build artifacts | |
| uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0 | |
| with: | |
| name: ${{ env.dist-artifact-name }} | |
| path: dist/ | |
| - run: ls -lR | |
| - name: Upload to ${{ env.environment }} | |
| uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0 | |
| with: | |
| repository-url: ${{ fromJson(env.environment-info)[env.environment].upload-url }} | |
| update_version: | |
| name: Update ni.datastore version | |
| runs-on: ubuntu-latest | |
| needs: [build_ni_datastore] | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| steps: | |
| - name: Check out repo | |
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| - name: Set up Python | |
| uses: ni/python-actions/setup-python@9768589f3e50672173dad75a6fc181e4a85d33fa # v0.7.0 | |
| - name: Set up Poetry | |
| uses: ni/python-actions/setup-poetry@9768589f3e50672173dad75a6fc181e4a85d33fa # v0.7.0 | |
| - name: Update project version | |
| uses: ni/python-actions/update-project-version@9768589f3e50672173dad75a6fc181e4a85d33fa # v0.7.0 |