Files
fleet/templates/package/.github/workflows/git-release.yml
Cato b6a86ec100 fix(packages): one publish.yml shape with a no-publish npm link check; template workflows stay prettier-clean in any package repo's config (#314)
Problem: templates/package/publish.yml was the old tag-only, variable-gated shape while whenkit, listkit, searchkit, accountkit, chartkit and geo-kit already run a newer one (main + tag + dispatch, first-publish bootstrap), and nothing could tell whether npm trusted a package's workflow without publishing. The synced release.yml also failed prettier --check in package repos configured with single quotes (design-tokens, sitekit, threadkit, ai-forms), which left four template-sync pull requests red.

Change: the template adopts the newer publish.yml plus a diagnose_auth dispatch input (HTTP 200 = linked, 404 = not; the response body is never printed). Every template workflow carries a prettier-ignore on its root node. SHARED.md no longer says npm is a later, passkey-batched step.
2026-10-28 02:34:01 +01:00

47 lines
1.5 KiB
YAML

# prettier-ignore
name: Verified Git release
on:
workflow_run:
workflows: [CI]
types: [completed]
branches: [main]
permissions:
contents: write
concurrency:
group: verified-git-release
cancel-in-progress: false
jobs:
release:
if: >-
github.event.workflow_run.conclusion == 'success' &&
github.event.workflow_run.head_repository.full_name == github.repository &&
github.event.workflow_run.head_branch == 'main' &&
github.event.workflow_run.event != 'pull_request'
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v7
with:
ref: ${{ github.event.workflow_run.head_sha }}
fetch-depth: 0
- name: Tag the verified immutable artifact, even before npm bootstrap
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERIFIED_SHA: ${{ github.event.workflow_run.head_sha }}
run: |
set -euo pipefail
version=$(node -p "require('./package.json').version")
if ! [[ "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Only stable package versions get a Git release" >&2
exit 1
fi
tag="v$version"
if git show-ref --verify --quiet "refs/tags/$tag"; then
echo "$tag already exists; immutable tags are never moved."
exit 0
fi
git tag "$tag" "$VERIFIED_SHA"
git push origin "refs/tags/$tag"
gh release create "$tag" --repo "$GITHUB_REPOSITORY" \
--verify-tag --title "$tag" --generate-notes