release: synchronize project guidance for v0.4.1 #9
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: Release | |
| on: | |
| push: | |
| tags: ["v*"] | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: release-${{ github.ref }} | |
| cancel-in-progress: false | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.10" | |
| - run: python -m pip install -r requirements-dev.txt | |
| - name: Verify tag and package version | |
| run: python -m rewardharness.release --check-tag "$GITHUB_REF_NAME" | |
| - run: make release-check | |
| - uses: actions/upload-artifact@v6 | |
| with: | |
| name: distributions | |
| path: dist/ | |
| if-no-files-found: error | |
| pypi: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: pypi | |
| url: https://pypi.org/project/rewardharness/ | |
| permissions: | |
| id-token: write | |
| steps: | |
| - uses: actions/download-artifact@v8 | |
| with: | |
| name: distributions | |
| path: dist/ | |
| - uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| attestations: true | |
| github: | |
| needs: [build, pypi] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/download-artifact@v8 | |
| with: | |
| name: distributions | |
| path: dist/ | |
| - name: Create GitHub release | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| prerelease="" | |
| [[ "$GITHUB_REF_NAME" == *-* ]] && prerelease="--prerelease" | |
| gh release create "$GITHUB_REF_NAME" dist/* \ | |
| --repo "$GITHUB_REPOSITORY" \ | |
| --verify-tag \ | |
| --generate-notes $prerelease | |
| verify: | |
| needs: [pypi, github] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.10" | |
| - name: Wait for PyPI metadata | |
| run: | | |
| package_version=${GITHUB_REF_NAME#v} | |
| package_version=${package_version//-/} | |
| for attempt in {1..18}; do | |
| curl --fail --silent --output /dev/null \ | |
| "https://pypi.org/pypi/rewardharness/$package_version/json" && exit 0 | |
| echo "PyPI metadata not visible yet (attempt $attempt/18)" | |
| sleep 10 | |
| done | |
| exit 1 | |
| - name: Install and smoke-test the published artifact | |
| run: | | |
| package_version=${GITHUB_REF_NAME#v} | |
| package_version=${package_version//-/} | |
| python -m venv /tmp/rewardharness-pypi | |
| /tmp/rewardharness-pypi/bin/python -m pip install --quiet --upgrade pip | |
| for attempt in {1..18}; do | |
| if /tmp/rewardharness-pypi/bin/pip install \ | |
| --index-url https://pypi.org/simple \ | |
| --only-binary=:all: \ | |
| --no-deps \ | |
| "rewardharness==$package_version"; then | |
| break | |
| fi | |
| if [[ "$attempt" == "18" ]]; then | |
| exit 1 | |
| fi | |
| echo "PyPI Simple API not synchronized yet (attempt $attempt/18)" | |
| sleep 10 | |
| done | |
| /tmp/rewardharness-pypi/bin/rewardharness --version | |
| /tmp/rewardharness-pypi/bin/rewardharness release-status | |
| - name: Verify GitHub release | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: >- | |
| gh release view "$GITHUB_REF_NAME" | |
| --repo "$GITHUB_REPOSITORY" | |
| --json tagName,isPrerelease,url |