Release v1.0.38 #18
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 | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| permissions: | |
| contents: write | |
| id-token: write | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| steps: | |
| # CSO #10: SHA-pin all third-party + first-party actions. Tag refs are | |
| # mutable; a tag-rewrite on the action repo would otherwise let an | |
| # attacker run arbitrary code in our publish pipeline (which has the | |
| # OIDC token + npm Trusted Publisher access). | |
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| - uses: pnpm/action-setup@b906affcce14559ad1aafd4ab0e942779e9f58b1 # v4.0.0 | |
| with: | |
| version: 10 | |
| - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 | |
| with: | |
| node-version: '22' | |
| registry-url: 'https://registry.npmjs.org' | |
| cache: 'pnpm' | |
| - name: Upgrade npm (Trusted Publisher / OIDC requires npm >= 11.5.1) | |
| run: npm install -g npm@11.5.2 --force | |
| - name: Verify tag matches package.json version | |
| run: | | |
| TAG="${GITHUB_REF#refs/tags/v}" | |
| PKG=$(node -p "require('./package.json').version") | |
| if [ "$TAG" != "$PKG" ]; then | |
| echo "Tag v$TAG does not match package.json version $PKG" | |
| exit 1 | |
| fi | |
| echo "version=$PKG" >> $GITHUB_OUTPUT | |
| id: version | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| # CSO #18: gate on production-dep audit. High/critical CVEs block release. | |
| - name: Audit production dependencies | |
| run: pnpm audit --prod --audit-level=high | |
| # Sync PROTOCOL_VERSION + CLI .version() string from root package.json | |
| # BEFORE pnpm build, so the compiled dist embeds the right version. | |
| # Earlier this lived inside scripts/package.mjs, which ran AFTER build — | |
| # meaning every published artifact carried the previously-committed | |
| # version string (1.0.22 forever). | |
| - name: Sync version constants | |
| run: node scripts/sync-version.mjs | |
| # Parse every inline <script> in the relay's WEB_CLIENT_HTML and | |
| # LANDING_HTML strings. Catches template-literal escape mishaps | |
| # (`\/` collapsing to `/`, unescaped `\'` etc.) that hard-fail the | |
| # served page silently. See packages/relay/scripts/check-html-scripts.mts. | |
| - name: Check inline JS in relay HTML | |
| run: pnpm --filter @loopsy/relay run check:html | |
| - name: Build packages | |
| run: pnpm build | |
| - name: Assemble publishable package | |
| run: node scripts/package.mjs | |
| - name: Publish to npm (via Trusted Publisher / OIDC) | |
| run: npm publish --access public --provenance | |
| working-directory: package-dist | |
| # @loopsy/deploy-relay is its own published package. Its `prepack` runs | |
| # `scripts/sync-worker.mjs` (snapshots packages/relay/src into worker/) | |
| # and `tsc`, so the tarball is self-contained. Version is pinned from | |
| # the tag so it moves in lockstep with the main `loopsy` package. | |
| - name: Sync @loopsy/deploy-relay version from tag | |
| run: | | |
| TAG="${GITHUB_REF#refs/tags/v}" | |
| node -e "const fs=require('fs'); const p='./packages/deploy-relay/package.json'; const j=JSON.parse(fs.readFileSync(p,'utf8')); j.version='$TAG'; fs.writeFileSync(p, JSON.stringify(j,null,2)+'\n');" | |
| - name: Publish @loopsy/deploy-relay (Trusted Publisher / OIDC) | |
| run: npm publish --access public --provenance | |
| working-directory: packages/deploy-relay | |
| - name: Create GitHub Release | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| gh release create "${GITHUB_REF#refs/tags/}" \ | |
| --title "${GITHUB_REF#refs/tags/}" \ | |
| --generate-notes |