diff --git a/.github/workflows/release-loop-gate.yml b/.github/workflows/release-loop-gate.yml new file mode 100644 index 0000000..59afb72 --- /dev/null +++ b/.github/workflows/release-loop-gate.yml @@ -0,0 +1,63 @@ +name: Release loop-gate + +on: + push: + tags: + - 'loop-gate-v*' + workflow_dispatch: + inputs: + tag: + description: 'Tag to publish (e.g. loop-gate-v1.0.0)' + required: true + type: string + +permissions: + contents: read + id-token: write + +jobs: + test-and-publish: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v7 + with: + ref: ${{ github.event_name == 'workflow_dispatch' && format('refs/tags/{0}', github.event.inputs.tag) || github.ref }} + + - uses: actions/setup-node@v7 + with: + node-version: '22' + registry-url: 'https://registry.npmjs.org' + cache: 'npm' + cache-dependency-path: tools/loop-gate/package-lock.json + + - name: Ensure npm supports trusted publishing (OIDC) + run: npm install -g npm@latest + + - name: Install, build, test + working-directory: tools/loop-gate + run: | + npm ci + npm run build + npm test + + - name: Skip if version already published + id: check + working-directory: tools/loop-gate + run: | + VERSION=$(node -p "require('./package.json').version") + if npm view "@cobusgreyling/loop-gate@${VERSION}" version 2>/dev/null; then + echo "Version ${VERSION} already on npm — skipping publish." + echo "skip=true" >> "$GITHUB_OUTPUT" + else + echo "Publishing @cobusgreyling/loop-gate@${VERSION}" + echo "skip=false" >> "$GITHUB_OUTPUT" + fi + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + + - name: Publish to npm + if: steps.check.outputs.skip != 'true' + working-directory: tools/loop-gate + run: npm publish --access public --provenance + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/STATE.md b/STATE.md index 95c2cd0..8ca27c6 100644 --- a/STATE.md +++ b/STATE.md @@ -5,7 +5,7 @@ Last run: 2026-07-16T12:00:00Z (scheduled maintenance) ## High Priority (loop is acting or waiting on human) - Maintain loop readiness score ≥ 58 (current: **100**, level **L3**). -- npm publish in flight: `loop-worktree` 1.2.0, `loop-context` 1.3.0 (tags pushed this run). **`loop-gate` 1.0.0** still needs a `release-loop-gate.yml` workflow before first publish. +- npm publish in flight: `loop-worktree` 1.2.0, `loop-context` 1.3.0 (tags pushed this run). ## Watch List