ci: add the four caller workflows
Per docs/12 §2, with every input checked against the ops repo's actual workflow_call blocks rather than the doc — docs/12 originally described a template family that had never existed. Verified before writing: reusable-chrome-extension.yml takes package-manager/node-version/build-command/source-dir/release and declares NO secrets block, so passing a named secret to it would be a compile error; reusable-codeql.yml takes `languages` as a JSON-array string (the older codeql.yml's singular `language` is the wrong one); notify-ci-failure.yml declares DISCORD_CI_WEBHOOK required:true; announce-release.yml's secrets are optional. actions/checkout@v7 and setup-node@v6 are what the ops repo itself runs. Three traps the comments now carry, because each costs a run to rediscover: - leaving package-manager at its 'none' default skips install and build, then fails on `test -f ./manifest.json`, a file WXT never writes to the repo root; - reusable workflows do not inherit the caller's permissions, so every caller repeats its permissions block on the job; - the release announcement is a job INSIDE release.yml, not an `on: release: [published]` caller — a Release created by gh under the default GITHUB_TOKEN emits no event that starts new workflow runs, so the event-driven version silently never fires. The quality job is local because the reusable runs no quality gates at all. All four parse, and `npm run zip` emits .output/bookmarkmagic-0.1.0-chrome.zip, matching the glob release.yml uses. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
4 files changed
+197
No files matched your search
@@ -0,0 +1,56 @@
|
||||
# Caller stub — docs/12 §2.1.
|
||||
#
|
||||
# The `quality` job is local because the ops reusable runs NO quality gates at
|
||||
# all: its entire surface is install → build → assert manifest_version == 3 →
|
||||
# zip → upload. Lint, type-check, knip, coverage and the grep gate are ours.
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
concurrency:
|
||||
group: ci-${{ github.ref }}
|
||||
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
||||
|
||||
jobs:
|
||||
quality:
|
||||
name: Quality gates
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 15
|
||||
permissions:
|
||||
contents: read
|
||||
steps:
|
||||
- uses: actions/checkout@v7
|
||||
- uses: actions/setup-node@v6
|
||||
with:
|
||||
node-version: '24'
|
||||
cache: npm
|
||||
- run: npm ci
|
||||
- run: npm run lint # biome check .
|
||||
- run: npm run check # svelte-check + tsc --noEmit
|
||||
- run: npm run knip
|
||||
- run: npm run coverage # vitest --coverage, thresholds per docs/11 §1
|
||||
- run: npm run guard # the canonical grep gate, docs/08 §3
|
||||
|
||||
build:
|
||||
name: Build + package
|
||||
needs: quality
|
||||
# No `secrets:` here — the reusable declares no secrets block at all, and
|
||||
# passing a named secret to it is a workflow-compile error.
|
||||
uses: poli0981/.github/.github/workflows/reusable-chrome-extension.yml@main
|
||||
permissions:
|
||||
contents: read
|
||||
with:
|
||||
# All four are required in practice. Leaving package-manager at its
|
||||
# 'none' default skips install and build, then fails on
|
||||
# `test -f ./manifest.json` — a file WXT never writes to the repo root.
|
||||
package-manager: 'npm'
|
||||
node-version: '24'
|
||||
build-command: 'npm run build'
|
||||
source-dir: '.output/chrome-mv3'
|
||||
release: false
|
||||
@@ -0,0 +1,36 @@
|
||||
# Caller stub — docs/12 §2.2.
|
||||
#
|
||||
# Uses `reusable-codeql.yml` (CodeQL Action v4), NOT the older `codeql.yml`,
|
||||
# whose input is the singular `language`. This one takes `languages`: a JSON
|
||||
# array encoded as a string.
|
||||
#
|
||||
# ⚠️ Prerequisite: repo Settings → Advanced Security → CodeQL "Default setup"
|
||||
# must be DISABLED, or this advanced-setup workflow is rejected at SARIF upload.
|
||||
name: CodeQL
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
branches: [main]
|
||||
schedule:
|
||||
- cron: '0 14 * * 1' # weekly, Monday
|
||||
|
||||
permissions:
|
||||
security-events: write
|
||||
actions: read
|
||||
contents: read
|
||||
packages: read
|
||||
|
||||
jobs:
|
||||
analyze:
|
||||
# Reusable workflows do not inherit the caller's permissions — the block
|
||||
# below is repeated on the job on purpose.
|
||||
uses: poli0981/.github/.github/workflows/reusable-codeql.yml@main
|
||||
permissions:
|
||||
security-events: write
|
||||
actions: read
|
||||
contents: read
|
||||
packages: read
|
||||
with:
|
||||
languages: '["javascript-typescript"]'
|
||||
@@ -0,0 +1,25 @@
|
||||
# Caller stub — docs/12 §2.4.
|
||||
#
|
||||
# The reusable already filters to `conclusion == 'failure'` on the default
|
||||
# branch, so this caller needs no `if:`.
|
||||
#
|
||||
# ⚠️ It declares `DISCORD_CI_WEBHOOK` as `required: true`, so this workflow
|
||||
# fails until that repo secret exists (docs/12 §5).
|
||||
name: Notify CI failure
|
||||
|
||||
on:
|
||||
workflow_run:
|
||||
workflows: ['CI']
|
||||
types: [completed]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
actions: read
|
||||
|
||||
jobs:
|
||||
notify:
|
||||
uses: poli0981/.github/.github/workflows/notify-ci-failure.yml@main
|
||||
permissions:
|
||||
contents: read
|
||||
actions: read
|
||||
secrets: inherit
|
||||
@@ -0,0 +1,80 @@
|
||||
# Release — docs/12 §2.3.
|
||||
#
|
||||
# Standalone rather than the ops reusable: the reusable's `release` job only
|
||||
# runs `gh release create --generate-notes`. It produces no SHA256SUMS.txt
|
||||
# (required by docs/09 §5), performs no store submission, and exposes no
|
||||
# `outputs:`, so a caller cannot reference the zip it built.
|
||||
name: Release
|
||||
|
||||
on:
|
||||
push:
|
||||
tags: ['v*']
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
release:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 20
|
||||
permissions:
|
||||
contents: write # create the GitHub Release
|
||||
steps:
|
||||
- uses: actions/checkout@v7
|
||||
- uses: actions/setup-node@v6
|
||||
with:
|
||||
node-version: '24'
|
||||
cache: npm
|
||||
- run: npm ci
|
||||
|
||||
# The same gates as CI. A tag must never ship what a PR would have
|
||||
# blocked — pushing a tag skips the CI workflow's branch triggers.
|
||||
- run: npm run lint
|
||||
- run: npm run check
|
||||
- run: npm run knip
|
||||
- run: npm run coverage
|
||||
- run: npm run guard
|
||||
|
||||
- run: npm run zip # wxt zip → .output/<name>-<version>-chrome.zip
|
||||
|
||||
- name: Verify tag matches manifest version
|
||||
run: |
|
||||
set -euo pipefail
|
||||
MANIFEST_VERSION=$(jq -r '.version' .output/chrome-mv3/manifest.json)
|
||||
TAG_VERSION="${GITHUB_REF_NAME#v}"
|
||||
test "$MANIFEST_VERSION" = "$TAG_VERSION" \
|
||||
|| { echo "::error::tag $TAG_VERSION != manifest $MANIFEST_VERSION"; exit 1; }
|
||||
|
||||
- name: SHA256SUMS
|
||||
working-directory: .output
|
||||
run: sha256sum *-chrome.zip > SHA256SUMS.txt
|
||||
|
||||
- name: GitHub Release
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
gh release create "$GITHUB_REF_NAME" \
|
||||
.output/*-chrome.zip .output/SHA256SUMS.txt --generate-notes
|
||||
|
||||
# v1.0.x is published by hand (docs/12 §3) — first store reviews often
|
||||
# ask questions and want a human in the loop. Flipping the repo variable
|
||||
# CWS_AUTOPUBLISH to 'true' turns this on for v1.1+.
|
||||
- name: Publish to Chrome Web Store
|
||||
if: vars.CWS_AUTOPUBLISH == 'true'
|
||||
env:
|
||||
CHROME_EXTENSION_ID: ${{ secrets.CHROME_EXTENSION_ID }}
|
||||
CHROME_CLIENT_ID: ${{ secrets.CHROME_CLIENT_ID }}
|
||||
CHROME_CLIENT_SECRET: ${{ secrets.CHROME_CLIENT_SECRET }}
|
||||
CHROME_REFRESH_TOKEN: ${{ secrets.CHROME_REFRESH_TOKEN }}
|
||||
run: npx wxt submit --chrome-zip .output/*-chrome.zip
|
||||
|
||||
# A job INSIDE this workflow, not an `on: release: [published]` caller.
|
||||
# A Release created by `gh release create` under the default GITHUB_TOKEN
|
||||
# emits no event that starts new workflow runs, so an event-driven caller
|
||||
# would silently never fire.
|
||||
announce:
|
||||
needs: release
|
||||
uses: poli0981/.github/.github/workflows/announce-release.yml@main
|
||||
permissions:
|
||||
contents: read
|
||||
secrets: inherit
|
||||
Reference in new issue
Block a user