Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/cavimg-package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ on:
type: string
default: latest
dry_run:
description: "Pack/manifest check only. Does NOT test OIDC auth or contact the registry."
description: "Pack/manifest check. Does NOT test OIDC auth, and fails if the version is already published."
type: boolean
default: false

Expand Down Expand Up @@ -106,7 +106,7 @@ jobs:
args="--tag ${DIST_TAG} --provenance"
if [ "${DRY_RUN}" = "true" ]; then
args="${args} --dry-run"
echo "::warning::--dry-run only packs the tarball; it does NOT validate OIDC or trusted publisher config."
echo "::warning::--dry-run does NOT validate OIDC or trusted publisher config, and it still queries the registry — it exits 1 if this version is already published."
fi

case "${MODE}" in
Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ on:
branches:
- main
workflow_call:
inputs:
ref:
description: "Git ref or SHA to check out. Empty means the ref that triggered the run."
type: string
required: false
default: ""

permissions:
contents: read
Expand All @@ -26,6 +32,8 @@ jobs:

steps:
- uses: actions/checkout@v6
with:
ref: ${{ inputs.ref }}

- uses: pnpm/action-setup@b906affcce14559ad1aafd4ab0e942779e9f58b1 # v4
with:
Expand Down Expand Up @@ -57,6 +65,8 @@ jobs:

steps:
- uses: actions/checkout@v6
with:
ref: ${{ inputs.ref }}

- uses: actions/setup-go@v6
with:
Expand Down
10 changes: 8 additions & 2 deletions .github/workflows/dev-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,11 @@ jobs:
- name: Pack and inspect manifest
working-directory: packages/cavimg
run: |
echo "::notice::--dry-run packs the tarball only. It does NOT contact the registry, validate OIDC, or publish."
npm publish --dry-run --tag latest
npm pack --dry-run

version="$(node -p "require('./package.json').version")"
if npm view "cavimg@${version}" version >/dev/null 2>&1; then
echo "::notice::cavimg@${version} is already on npmjs. Bump packages/cavimg/package.json or merging to main cuts no release."
else
echo "::notice::cavimg@${version} is not on npmjs yet — merging to main will tag and release it."
fi
83 changes: 83 additions & 0 deletions .github/workflows/release-tag.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: release-tag

on:
pull_request:
types:
- closed
branches:
- main

permissions:
contents: read

concurrency:
group: release-tag-${{ github.ref }}
cancel-in-progress: false

jobs:
verify:
name: verify merged main
if: >-
github.event.pull_request.merged == true
&& github.event.pull_request.head.ref == 'dev'
&& github.event.pull_request.head.repo.full_name == github.repository
uses: ./.github/workflows/ci.yaml
permissions:
contents: read
with:
ref: ${{ github.event.pull_request.merge_commit_sha }}

tag:
name: tag release
needs: verify
runs-on: ubuntu-latest

permissions:
contents: write

steps:
- uses: actions/checkout@v6
with:
ref: ${{ github.event.pull_request.merge_commit_sha }}
fetch-depth: 0

- uses: actions/setup-node@v6
with:
node-version: "24"
package-manager-cache: false

- name: Create tag from package version
env:
MERGE_SHA: ${{ github.event.pull_request.merge_commit_sha }}
PR_NUMBER: ${{ github.event.pull_request.number }}
run: |
version="$(node -p "require('./packages/cavimg/package.json').version")"
tag="v${version}"

if git ls-remote --exit-code --tags origin "refs/tags/${tag}" >/dev/null 2>&1; then
echo "::notice::Tag ${tag} already exists — no release cut."
{
echo "### No release cut"
echo ""
echo "\`packages/cavimg/package.json\` is still at **${version}** and \`${tag}\` already exists."
echo "Bump the version in a PR to \`dev\` to cut the next release."
} >> "$GITHUB_STEP_SUMMARY"
exit 0
fi

git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git tag -a "${tag}" -m "cavimg ${version} (PR #${PR_NUMBER})" "${MERGE_SHA}"
git push origin "refs/tags/${tag}"

echo "::notice::Created tag ${tag} at ${MERGE_SHA}"
{
echo "### Tagged ${tag}"
echo ""
echo "Commit: \`${MERGE_SHA}\`"
echo ""
echo "**Publishing is not automatic.** Tags pushed by \`GITHUB_TOKEN\` do not trigger"
echo "other workflows, so \`cavimg-package.yaml\` did not fire."
echo ""
echo "To release: Actions → **cavimg-package** → Run workflow → \`mode: stage\`."
} >> "$GITHUB_STEP_SUMMARY"
Loading