Files
bookmarkmagic/.github/workflows/release.yml
T
poli0981andClaude Opus 5 6c4c307a25 fix(ci): remove a keyword GitHub rejects on reusable-workflow callers
`continue-on-error` is not allowed on a job that calls a reusable workflow.
GitHub answers with "Property continue-on-error is not allowed" and refuses the
**whole file** — a startup_failure with zero jobs and no log, not one failed
job. Confirmed against two GitHub community discussions, one of which is an
open, unanswered feature request asking for the capability.

release.yml's announce job has carried that keyword since 5f4c6e7. That commit
landed *after* the v1.0.0 tag object and no tag has been pushed since, so the
first v1.0.1 tag would have been its first execution — and the release would
have died before running a single job, in exactly the silent shape this project
already hit once with the `contents: write` grant (2c8fba9). The previous commit
in this branch then copied the same mistake into notify-ci-failure.yml.

Both are now gated with `if:` on a repo variable instead. A variable and not a
secret because secrets cannot be referenced in a job-level `if:`, and unset
means skipped — so the release stays green and CI stays quiet until the owner
opts in by setting DISCORD_ANNOUNCE / DISCORD_CI_NOTIFY alongside the webhooks.
Same idiom as the CWS_AUTOPUBLISH gate already in release.yml.

docs/12's samples and its §5 checklist updated in the same commit; docs are
binding here, and leaving the invalid keyword in the spec would have had the
next reader put it straight back.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-03 19:27:43 +07:00

120 lines
5.2 KiB
YAML

# 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@v7
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
# Gate the artifact, not just the config it was built from. A tag is the
# last point at which an unintended permission can still be stopped.
- run: npm run check:manifest
- 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
# Idempotent on purpose. `gh release create` fails outright if a Release
# for the tag already exists, so any failure AFTER this step — realistically
# the CWS publish below, once CWS_AUTOPUBLISH is on — used to strand the
# tag: re-running the workflow could not get past this line, and the only
# recovery was deleting the Release and the tag by hand (docs/13 §7).
- name: GitHub Release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -euo pipefail
if gh release view "$GITHUB_REF_NAME" >/dev/null 2>&1; then
echo "Release $GITHUB_REF_NAME exists — re-uploading assets."
gh release upload "$GITHUB_REF_NAME" \
.output/*-chrome.zip .output/SHA256SUMS.txt --clobber
else
gh release create "$GITHUB_REF_NAME" \
.output/*-chrome.zip .output/SHA256SUMS.txt --generate-notes
fi
# 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
# A Discord notification is not part of the release. The reusable exits 1 on
# "No webhooks configured" when DISCORD_RELEASES_WEBHOOK and
# DISCORD_REPO_WEBHOOK are both unset (docs/12 §5 lists them as optional),
# which turned the v1.0.0 run red even though the Release, the zip and
# SHA256SUMS.txt had all published correctly. A red run on a good release is
# worse than a missing announcement: it trains you to ignore the colour.
#
# ⚠️ This used to say `continue-on-error: true`, which GitHub REJECTS on a
# job that calls a reusable workflow — "Property continue-on-error is not
# allowed". The whole file is then invalid and the run is a startup_failure
# with zero jobs and no log, exactly like the `contents: write` mistake in
# 2c8fba9. It was never caught because that fix landed after the v1.0.0 tag
# and no tag has been pushed since, so the first v1.0.1 tag would have been
# its first execution. Gate on a repo VARIABLE instead — allowed in `if:`,
# unlike a secret, and the same idiom as CWS_AUTOPUBLISH above.
if: vars.DISCORD_ANNOUNCE == 'true'
uses: poli0981/.github/.github/workflows/announce-release.yml@main
permissions:
contents: read
with:
# REQUIRED here, and only because of the comment above. The reusable
# resolves `TAG="${INPUT_TAG:-$EVENT_TAG}"` with EVENT_TAG =
# github.event.release.tag_name — which is empty under `on: push: tags`,
# so without this the job exits 1 on "No release tag available" and the
# announcement never fires for any release.
tag_override: ${{ github.ref_name }}
secrets: inherit