Skip to content

deploy-relay: offer to repoint the daemon after a successful deploy #13

deploy-relay: offer to repoint the daemon after a successful deploy

deploy-relay: offer to repoint the daemon after a successful deploy #13

Workflow file for this run

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
- 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