JobForge v2.14.71 #90
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 to npm | |
| on: | |
| release: | |
| types: [published] | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: '22' | |
| registry-url: 'https://registry.npmjs.org' | |
| cache: 'npm' | |
| - name: Set version from release tag | |
| run: | | |
| VERSION="${GITHUB_REF_NAME#v}" | |
| echo "VERSION=$VERSION" >> $GITHUB_ENV | |
| - name: Verify Quality checks passed for release commit | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| SHA=$(git rev-parse HEAD) | |
| echo "Verifying quality check-run for $SHA" | |
| DEADLINE=$(( $(date +%s) + 1800 )) # 30 min | |
| STATUS="" | |
| CONCLUSION="" | |
| while [ "$(date +%s)" -lt "$DEADLINE" ]; do | |
| read -r STATUS CONCLUSION <<<"$(gh api "repos/${{ github.repository }}/commits/$SHA/check-runs" \ | |
| --jq '[.check_runs[] | select(.name == "quality")] | sort_by(.started_at) | last | "\(.status // "missing") \(.conclusion // "null")"')" | |
| echo "quality check-run: status=$STATUS conclusion=$CONCLUSION" | |
| if [ "$STATUS" = "completed" ]; then | |
| break | |
| fi | |
| sleep 15 | |
| done | |
| if [ "$STATUS" != "completed" ]; then | |
| echo "::error::Quality checks for $SHA never completed within 30min (last status: $STATUS)." | |
| exit 1 | |
| fi | |
| if [ "$CONCLUSION" != "success" ]; then | |
| echo "::error::Quality checks for $SHA did not succeed (conclusion: $CONCLUSION). Fix before re-releasing." | |
| exit 1 | |
| fi | |
| echo "Quality checks succeeded for $SHA" | |
| - name: Verify package.json version matches release tag | |
| run: npm run release:check-source -- "$VERSION" | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Publish to npm (with provenance) | |
| # `npm publish` fires the `prepack` script, which runs | |
| # `build:config` to regenerate the harness config trees and shared | |
| # client skill from iso/ into the tarball. The files are gitignored, so | |
| # this step is how they reach consumers. | |
| run: npm publish --provenance --access public | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |