Skip to content

release: prepare v0.3.0 migration boundary #6

release: prepare v0.3.0 migration boundary

release: prepare v0.3.0 migration boundary #6

Workflow file for this run

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@v4
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@v4
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@v4
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
/tmp/rewardharness-pypi/bin/pip install \
--index-url https://pypi.org/simple \
--only-binary=:all: \
--no-deps \
"rewardharness==$package_version"
/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