ci(publish): update workflow to require release_tag input
CI / test-and-build (push) Successful in 25s

This commit is contained in:
warkanum committed 2026-09-23 20:40:26 +02:00
1 parent 03135675b9
commit bcbdfc0262
2 files changed
+21 -8

No files matched your search

+15 -3
View File
@@ -4,6 +4,11 @@ on:
tags:
- 'v*'
workflow_dispatch:
inputs:
release_tag:
description: Existing tag to publish (must match package.json version, e.g. v1.1.0)
required: true
type: string
jobs:
publish:
@@ -12,6 +17,8 @@ jobs:
PACKAGE_REGISTRY: https://git.warky.dev/api/packages/${{ gitea.repository_owner }}/npm/
steps:
- uses: https://github.com/actions/checkout@v4
with:
ref: ${{ inputs.release_tag || gitea.ref }}
- uses: https://github.com/pnpm/action-setup@v4
- uses: https://github.com/actions/setup-node@v4
with:
@@ -21,13 +28,18 @@ jobs:
cache: pnpm
- name: Verify release tag
env:
RELEASE_REF: ${{ gitea.ref }}
EVENT_NAME: ${{ gitea.event_name }}
TRIGGER_REF: ${{ gitea.ref }}
RELEASE_TAG: ${{ inputs.release_tag }}
run: |
node --input-type=module <<'JS'
import { readFileSync } from 'node:fs';
const { version } = JSON.parse(readFileSync('package.json', 'utf8'));
if (process.env.RELEASE_REF !== `refs/tags/v${version}`) {
throw new Error(`Release tag must be v${version} to match package.json`);
const tag = process.env.EVENT_NAME === 'workflow_dispatch'
? process.env.RELEASE_TAG
: process.env.TRIGGER_REF.replace(/^refs\/tags\//, '');
if (tag !== `v${version}`) {
throw new Error(`Release tag must be v${version}; received ${tag || '(empty)'}`);
}
JS
- run: pnpm install --frozen-lockfile
+6 -5
View File
@@ -35,11 +35,12 @@ repository's user or organization (not necessarily the npm scope `warkypublic`).
2. Run `pnpm exec changeset version` to apply pending changesets. Review and commit
the updated version, changelog, and consumed changesets with the release changes.
3. Create and push a matching tag to the Gitea remote, for example `v1.1.0` for
package version `1.1.0`. To dispatch manually, select that existing matching tag
as the workflow run ref in the Actions UI; the workflow rejects branch refs and
tags that do not exactly match the package version. It runs the tests and
bundle checks, then publishes using pnpm so the `publishConfig` overrides point
consumers to the built JavaScript and declarations.
package version `1.1.0`. To publish manually, run the workflow from the Actions
UI and set its required `release_tag` input to the matching tag. Checkout and
validation use that tag; the workflow rejects tags that do not exactly match the
package version. It then runs tests and bundle checks before publishing with
pnpm, which applies the `publishConfig` entries for built JavaScript and
declarations.
Stable versions receive the `latest` dist-tag; prereleases receive `next`.
Existing package versions cannot be overwritten; release a new version instead.