fix(instructions): separate context and rules from template in JSON o… #1
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 (prepare) | |
| on: | |
| push: | |
| branches: [main] | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| id-token: write # Required for npm OIDC trusted publishing | |
| concurrency: | |
| group: release-${{ github.ref }} | |
| cancel-in-progress: false | |
| jobs: | |
| prepare: | |
| if: github.repository == 'Fission-AI/OpenSpec' | |
| runs-on: ubuntu-latest | |
| steps: | |
| # Generate GitHub App token first - used for checkout and changesets | |
| # This allows git operations to trigger CI workflows on the version PR | |
| # (GITHUB_TOKEN cannot trigger workflows by design) | |
| - name: Generate GitHub App Token | |
| id: app-token | |
| uses: actions/create-github-app-token@v2 | |
| with: | |
| app-id: ${{ vars.APP_ID }} | |
| private-key: ${{ secrets.APP_PRIVATE_KEY }} | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| token: ${{ steps.app-token.outputs.token }} | |
| - uses: pnpm/action-setup@v4 | |
| with: | |
| version: 9 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '24' # Node 24 includes npm 11.5.1+ required for OIDC | |
| cache: 'pnpm' | |
| registry-url: 'https://registry.npmjs.org' | |
| - run: pnpm install --frozen-lockfile | |
| # Opens/updates the Version Packages PR; publishes when the Version PR merges | |
| - name: Create/Update Version PR | |
| id: changesets | |
| uses: changesets/action@v1 | |
| with: | |
| title: 'chore(release): version packages' | |
| createGithubReleases: true | |
| # Use CI-specific release script: relies on version PR having been merged | |
| # so package.json already contains the bumped version. | |
| publish: pnpm run release:ci | |
| env: | |
| GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} | |
| # npm authentication handled via OIDC trusted publishing (no token needed) | |
| # Trigger release notes polishing after a release is published | |
| # Uses repository_dispatch instead of workflow_dispatch because: | |
| # - workflow_dispatch requires actions:write permission (GitHub App doesn't have it) | |
| # - repository_dispatch works with contents:write (which we already have) | |
| - name: Polish release notes | |
| if: steps.changesets.outputs.published == 'true' | |
| env: | |
| GH_TOKEN: ${{ steps.app-token.outputs.token }} | |
| run: | | |
| # Get version from package.json (just bumped by changesets) | |
| TAG="v$(jq -r .version package.json)" | |
| echo "Triggering polish workflow for $TAG" | |
| gh api repos/${{ github.repository }}/dispatches \ | |
| --method POST \ | |
| --input - <<< "{\"event_type\":\"polish-release-notes\",\"client_payload\":{\"tag_name\":\"$TAG\"}}" |