Repository navigation
v0.9.4 #27
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 SDK | |
| on: | |
| release: | |
| types: [published] | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: publish-sdk | |
| cancel-in-progress: false | |
| # Retain pending runs for versions that already have a GitHub release. | |
| queue: max | |
| defaults: | |
| run: | |
| shell: bash | |
| jobs: | |
| validate: | |
| if: github.event.release.prerelease == false | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| steps: | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| with: | |
| fetch-depth: 0 | |
| persist-credentials: false | |
| - name: Validate release tag and ancestry | |
| env: | |
| RELEASE_TAG: ${{ github.event.release.tag_name }} | |
| run: | | |
| git merge-base --is-ancestor HEAD origin/main | |
| [[ "$RELEASE_TAG" =~ ^v(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$ ]] | |
| test "$(git rev-parse HEAD)" = "$(git rev-parse "refs/tags/$RELEASE_TAG^{commit}")" | |
| test "$RELEASE_TAG" = "v$(jq -er '.["."]' .release-please-manifest.json)" | |
| check: | |
| needs: validate | |
| uses: ./.github/workflows/ci.yml | |
| build: | |
| needs: [validate, check] | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| steps: | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| with: | |
| persist-credentials: false | |
| - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5 | |
| with: | |
| python-version: '3.14' | |
| - uses: astral-sh/setup-uv@d0cc045d04ccac9d8b7881df0226f9e82c39688e # v6 | |
| - run: uv sync --frozen | |
| - run: uv run python -m build | |
| - name: Check package identity and release version | |
| env: | |
| RELEASE_TAG: ${{ github.event.release.tag_name }} | |
| run: bash scripts/check_package.sh "${RELEASE_TAG#v}" | |
| - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: | |
| name: release-package | |
| path: dist/* | |
| if-no-files-found: error | |
| publish: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| environment: | |
| name: pypi | |
| url: https://pypi.org/project/volcano-sdk-python/ | |
| permissions: | |
| id-token: write | |
| steps: | |
| # Publishing receives checked artifacts without executing SDK source. | |
| - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | |
| with: | |
| name: release-package | |
| path: dist | |
| - name: Publish distributions to PyPI | |
| uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # v1.14.2 | |
| release-link: | |
| needs: publish | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Link the published PyPI version in the release notes | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| GH_REPO: ${{ github.repository }} | |
| RELEASE_TAG: ${{ github.event.release.tag_name }} | |
| run: | | |
| notes="$(gh release view "$RELEASE_TAG" --json body --jq '.body')" | |
| link="[View ${RELEASE_TAG} on PyPI](https://pypi.org/project/volcano-sdk-python/${RELEASE_TAG#v}/)" | |
| if [[ "$notes" != *"$link"* ]]; then | |
| printf '%s\n\n%s\n' "$notes" "$link" | gh release edit "$RELEASE_TAG" --notes-file - | |
| fi |