|
| 1 | +# release.yml — triggered ONLY on a v* tag push. Builds the .skill deliverable |
| 2 | +# and attaches it to a GitHub Release. |
| 3 | +# |
| 4 | +# Caveat (METHOD §7): a green PR does NOT exercise this workflow — it runs only |
| 5 | +# at the next v* tag. Validate the release path at that tag, never assume it. |
| 6 | +# |
| 7 | +# The version is never typed here: package_skill.py reads it from the suite's |
| 8 | +# metadata.version (SKILL.md frontmatter) and names the archive from it. The |
| 9 | +# guard below refuses to publish when the pushed tag and that version disagree — |
| 10 | +# so a release cannot advertise a version its artifact does not carry. |
| 11 | +name: release |
| 12 | + |
| 13 | +on: |
| 14 | + push: |
| 15 | + tags: ["v*"] |
| 16 | + |
| 17 | +permissions: |
| 18 | + contents: write # required to create a Release and upload assets |
| 19 | + |
| 20 | +jobs: |
| 21 | + release: |
| 22 | + name: release |
| 23 | + runs-on: ubuntu-latest |
| 24 | + steps: |
| 25 | + - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 |
| 26 | + - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 |
| 27 | + with: |
| 28 | + python-version: "3.12" |
| 29 | + - name: Build the .skill and verify it matches the tag |
| 30 | + run: | |
| 31 | + set -euo pipefail |
| 32 | + # package_skill.py validates the suite, reads metadata.version from |
| 33 | + # SKILL.md (never typed), and writes the stamped archive into dist/ |
| 34 | + # (git-ignored, so a clean checkout starts empty and exactly one |
| 35 | + # artifact is produced). It prints the archive path on stdout. |
| 36 | + artifact="$(python skills/project-pilot/modules/skill-packaging/scripts/package_skill.py skills/project-pilot --out-dir dist)" |
| 37 | + echo "Built: ${artifact}" |
| 38 | + # Guard (closes the channel S42 retires): the pushed tag must name the |
| 39 | + # same version the artifact carries. ${GITHUB_REF_NAME} is the tag, |
| 40 | + # e.g. v0.17.0; the artifact is project-pilot_v<version>_<date>.skill. |
| 41 | + # The quoted prefix is literal (tag metacharacters cannot glob); only |
| 42 | + # the date wildcard floats. On disagreement, abort BEFORE the release. |
| 43 | + case "$(basename "${artifact}")" in |
| 44 | + "project-pilot_${GITHUB_REF_NAME}_"*.skill) ;; |
| 45 | + *) |
| 46 | + echo "ERROR: tag ${GITHUB_REF_NAME} does not match built artifact $(basename "${artifact}")" >&2 |
| 47 | + exit 1 |
| 48 | + ;; |
| 49 | + esac |
| 50 | + - name: Create release and attach the artifact |
| 51 | + env: |
| 52 | + GH_TOKEN: ${{ github.token }} |
| 53 | + run: gh release create "${GITHUB_REF_NAME}" dist/* --generate-notes |
0 commit comments