|
| 1 | +name: Release Please |
| 2 | + |
| 3 | +# release-please (#684) owns versioning + CHANGELOG.md. On each push to `main` |
| 4 | +# it maintains a release PR ("chore(main): release X.Y.Z") that bumps the version |
| 5 | +# (in implementations/python/pyproject.toml via extra-files) and updates the |
| 6 | +# repo-root CHANGELOG.md from the Conventional Commits since the last release. |
| 7 | +# Merging that PR tags `vX.Y.Z` and cuts the GitHub Release; the publish job then |
| 8 | +# builds the corpus-bundled wheel/sdist (#537) and publishes to PyPI over OIDC |
| 9 | +# trusted publishing. |
| 10 | +# |
| 11 | +# Feature PRs never touch CHANGELOG.md (release-please owns it) — no fragment |
| 12 | +# collisions. The version literal is `[project] version` in the subdir pyproject; |
| 13 | +# `aces.__version__` derives from the installed distribution metadata. |
| 14 | +# |
| 15 | +# Caveat: the release PR is opened by GITHUB_TOKEN, so required CI checks do not |
| 16 | +# auto-run on it — admin-merge it, or give release-please a PAT so checks run. |
| 17 | +# First release + PyPI setup: docs/explain/releasing.md. |
| 18 | +on: |
| 19 | + push: |
| 20 | + branches: [main] |
| 21 | + |
| 22 | +permissions: |
| 23 | + contents: read |
| 24 | + |
| 25 | +concurrency: |
| 26 | + group: release-please |
| 27 | + cancel-in-progress: false |
| 28 | + |
| 29 | +jobs: |
| 30 | + release-please: |
| 31 | + runs-on: ubuntu-latest |
| 32 | + permissions: |
| 33 | + contents: write # create/maintain the release PR, tag, and Release |
| 34 | + pull-requests: write # maintain the release PR |
| 35 | + outputs: |
| 36 | + release_created: ${{ steps.rp.outputs.release_created }} |
| 37 | + tag_name: ${{ steps.rp.outputs.tag_name }} |
| 38 | + steps: |
| 39 | + - uses: googleapis/release-please-action@5c625bfb5d1ff62eadeeb3772007f7f66fdcf071 # v4.4.1 |
| 40 | + id: rp |
| 41 | + with: |
| 42 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 43 | + config-file: release-please-config.json |
| 44 | + manifest-file: .release-please-manifest.json |
| 45 | + |
| 46 | + publish: |
| 47 | + needs: release-please |
| 48 | + if: needs.release-please.outputs.release_created == 'true' |
| 49 | + runs-on: ubuntu-latest |
| 50 | + environment: pypi |
| 51 | + permissions: |
| 52 | + contents: write # upload the built distributions to the Release |
| 53 | + id-token: write # OIDC trusted publishing to PyPI (no stored token) |
| 54 | + steps: |
| 55 | + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 |
| 56 | + with: |
| 57 | + fetch-depth: 0 |
| 58 | + |
| 59 | + - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6 |
| 60 | + with: |
| 61 | + python-version: "3.12" |
| 62 | + |
| 63 | + - name: Install uv |
| 64 | + uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8 |
| 65 | + |
| 66 | + - name: Build the corpus-bundled wheel + sdist |
| 67 | + run: uv build --out-dir dist implementations/python |
| 68 | + |
| 69 | + - name: Verify the contract corpus is bundled in the wheel (#537) |
| 70 | + run: | |
| 71 | + python - <<'PY' |
| 72 | + import glob |
| 73 | + import sys |
| 74 | + import zipfile |
| 75 | +
|
| 76 | + wheels = glob.glob("dist/aces_sdl-*.whl") |
| 77 | + if len(wheels) != 1: |
| 78 | + sys.exit(f"expected exactly one wheel, found {wheels}") |
| 79 | + names = zipfile.ZipFile(wheels[0]).namelist() |
| 80 | + required = [ |
| 81 | + "aces_contracts/_corpus/profiles/backend/provisioning-only.json", |
| 82 | + "aces_contracts/_corpus/fixtures/", |
| 83 | + "aces_contracts/_corpus/concept-authority/controlled-vocabularies-v1.json", |
| 84 | + "aces_contracts/_corpus/schemas/", |
| 85 | + ] |
| 86 | + missing = [r for r in required if not any(n == r or n.startswith(r) for n in names)] |
| 87 | + if missing: |
| 88 | + sys.exit(f"wheel is missing corpus payload: {missing}") |
| 89 | + print(f"corpus payload present: {sum(n.startswith('aces_contracts/_corpus/') for n in names)} files") |
| 90 | + PY |
| 91 | +
|
| 92 | + - name: Publish to PyPI (OIDC trusted publishing) |
| 93 | + uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # release/v1 |
| 94 | + with: |
| 95 | + packages-dir: dist |
| 96 | + |
| 97 | + - name: Attach the distributions to the GitHub Release |
| 98 | + env: |
| 99 | + GH_TOKEN: ${{ github.token }} |
| 100 | + TAG: ${{ needs.release-please.outputs.tag_name }} |
| 101 | + run: gh release upload "${TAG}" dist/* --clobber |
0 commit comments