ni.measurements.data.v1.proto 1.1.0.dev0 #103
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 package | |
| on: | |
| release: | |
| types: [published] | |
| workflow_dispatch: | |
| inputs: | |
| environment: | |
| description: The environment to publish to. | |
| default: 'none' | |
| required: true | |
| type: choice | |
| options: | |
| - none | |
| - pypi | |
| - testpypi | |
| package-name: | |
| description: The name of the package to publish. | |
| default: 'none' | |
| required: true | |
| type: choice | |
| options: | |
| - none | |
| - ni-grpc-extensions | |
| - ni.datamonikers.v1.client | |
| - ni.datamonikers.v1.proto | |
| - ni.grpcdevice.v1.proto | |
| - ni.measurementlink.discovery.v1.client | |
| - ni.measurementlink.discovery.v1.proto | |
| - ni.measurementlink.measurement.v1.proto | |
| - ni.measurementlink.measurement.v2.proto | |
| - ni.measurementlink.pinmap.v1.client | |
| - ni.measurementlink.pinmap.v1.proto | |
| - ni.measurementlink.proto | |
| - ni.measurementlink.sessionmanagement.v1.client | |
| - ni.measurementlink.sessionmanagement.v1.proto | |
| - ni.measurements.data.v1.client | |
| - ni.measurements.data.v1.proto | |
| - ni.measurements.metadata.v1.client | |
| - ni.measurements.metadata.v1.proto | |
| - ni.panels.v1.proto | |
| - ni.protobuf.types | |
| env: | |
| 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: | |
| get_publish_info: | |
| name: Get publish info | |
| runs-on: ubuntu-latest | |
| outputs: | |
| package-name: ${{ steps.get_package_name_and_version.outputs.package-name }} | |
| package-version: ${{ steps.get_package_name_and_version.outputs.package-version }} | |
| steps: | |
| - name: Get package name and package version | |
| id: get_package_name_and_version | |
| run: | | |
| EVENT_NAME="${{ github.event_name }}" | |
| if [ "$EVENT_NAME" == "release" ]; then | |
| EVENT_TAG="${{ github.event.release.tag_name }}" | |
| PKG_NAME=$(echo "$EVENT_TAG" | cut -d / -f 1) | |
| echo "package-name=$PKG_NAME" >> $GITHUB_OUTPUT | |
| PKG_VERSION=$(echo "$EVENT_TAG" | cut -d / -f 2) | |
| echo "package-version=$PKG_VERSION" >> $GITHUB_OUTPUT | |
| else | |
| echo "package-name=${{ inputs.package-name }}" >> $GITHUB_OUTPUT | |
| echo "package-version=unused" >> $GITHUB_OUTPUT | |
| fi | |
| get_package_info: | |
| name: Get package info for ${{ needs.get_publish_info.outputs.package-name }} | |
| uses: ./.github/workflows/get_package_info.yml | |
| needs: get_publish_info | |
| with: | |
| package-name: ${{ needs.get_publish_info.outputs.package-name }} | |
| check_analyzers: | |
| name: Check analyzers for ${{ needs.get_publish_info.outputs.package-name }} | |
| uses: ./.github/workflows/check_analyzers.yml | |
| needs: [get_publish_info, get_package_info] | |
| with: | |
| package-name: ${{ needs.get_publish_info.outputs.package-name }} | |
| package-basepath: ${{ needs.get_package_info.outputs.package-basepath }} | |
| install-extras: ${{ needs.get_package_info.outputs.install-extras }} | |
| check_docs: | |
| name: Check docs | |
| uses: ./.github/workflows/check_docs.yml | |
| needs: [get_publish_info, get_package_info] | |
| with: | |
| package-name: ${{ needs.get_publish_info.outputs.package-name }} | |
| package-basepath: ${{ needs.get_package_info.outputs.package-basepath }} | |
| build_package: | |
| name: Build ${{ needs.get_publish_info.outputs.package-name }} | |
| runs-on: ubuntu-latest | |
| needs: [get_publish_info, get_package_info, check_analyzers, check_docs] | |
| steps: | |
| - name: Check out repo | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Set up Python | |
| uses: ni/python-actions/setup-python@aa64e60612cb078b0c2ada666becbd70d4817d55 # v0.7.1 | |
| - name: Set up Poetry | |
| uses: ni/python-actions/setup-poetry@aa64e60612cb078b0c2ada666becbd70d4817d55 # v0.7.1 | |
| - name: Check project version | |
| if: github.event_name == 'release' | |
| uses: ni/python-actions/check-project-version@aa64e60612cb078b0c2ada666becbd70d4817d55 # v0.7.1 | |
| with: | |
| project-directory: ./${{ needs.get_package_info.outputs.package-basepath }}/${{ needs.get_publish_info.outputs.package-name }} | |
| expected-version: ${{ needs.get_publish_info.outputs.package-version }} | |
| - name: Build distribution packages | |
| run: poetry build | |
| working-directory: ${{ github.workspace }}/${{ needs.get_package_info.outputs.package-basepath }}/${{ needs.get_publish_info.outputs.package-name }} | |
| - name: Upload build artifacts | |
| uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0 | |
| with: | |
| name: ${{ needs.get_publish_info.outputs.package-name }}-distribution-packages | |
| path: ./${{ needs.get_package_info.outputs.package-basepath }}/${{ needs.get_publish_info.outputs.package-name }}/dist/* | |
| publish_to_pypi: | |
| name: Publish ${{ needs.get_publish_info.outputs.package-name }} to PyPI | |
| if: github.event_name == 'release' || inputs.environment != 'none' | |
| runs-on: ubuntu-latest | |
| needs: [get_publish_info, get_package_info, build_package] | |
| 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/${{ needs.get_publish_info.outputs.package-name }} | |
| permissions: | |
| id-token: write | |
| steps: | |
| - name: Download build artifacts | |
| uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0 | |
| with: | |
| name: ${{ needs.get_publish_info.outputs.package-name }}-distribution-packages | |
| path: ./${{ needs.get_package_info.outputs.package-basepath }}/${{ needs.get_publish_info.outputs.package-name }}/dist/ | |
| - run: ls -lR | |
| working-directory: ${{ github.workspace }}/${{ needs.get_package_info.outputs.package-basepath }}/${{ needs.get_publish_info.outputs.package-name }} | |
| - 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 }} | |
| packages-dir: ./${{ needs.get_package_info.outputs.package-basepath }}/${{ needs.get_publish_info.outputs.package-name }}/dist | |
| update_version: | |
| name: Update ${{ needs.get_publish_info.outputs.package-name }} version | |
| runs-on: ubuntu-latest | |
| needs: [get_publish_info, get_package_info, build_package] | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| steps: | |
| - name: Check out repo | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Set up Python | |
| uses: ni/python-actions/setup-python@aa64e60612cb078b0c2ada666becbd70d4817d55 # v0.7.1 | |
| - name: Set up Poetry | |
| uses: ni/python-actions/setup-poetry@aa64e60612cb078b0c2ada666becbd70d4817d55 # v0.7.1 | |
| - name: Update project version | |
| uses: ni/python-actions/update-project-version@aa64e60612cb078b0c2ada666becbd70d4817d55 # v0.7.1 | |
| with: | |
| project-directory: ./${{ needs.get_package_info.outputs.package-basepath }}/${{ needs.get_publish_info.outputs.package-name }} | |
| branch-prefix: users/build/${{ needs.get_publish_info.outputs.package-name }}- |