ci: harden release workflow
Pin actions to commit SHAs, restrict releases to main, serialize runs and run the full check before publishing. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
1 parent
5485b83a79
commit
ecd37584a0
1 file changed
+14
-2
@@ -6,19 +6,25 @@ on:
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
# Never run two releases at once: both would publish the same commit under different versions.
|
||||
concurrency:
|
||||
group: release
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
if: gitea.ref == 'refs/heads/main'
|
||||
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
|
||||
with:
|
||||
fetch-depth: 0
|
||||
fetch-tags: true
|
||||
|
||||
- name: Use Node.js 24.17.0
|
||||
uses: actions/setup-node@v6
|
||||
uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6.5.0
|
||||
with:
|
||||
node-version: '24.17.0'
|
||||
registry-url: 'https://registry.npmjs.org'
|
||||
@@ -27,6 +33,9 @@ jobs:
|
||||
- name: Install Dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Run Checks
|
||||
run: npm run check
|
||||
|
||||
- name: Set Release Version
|
||||
run: npm run version:place
|
||||
env:
|
||||
@@ -41,6 +50,9 @@ jobs:
|
||||
- name: Run Build
|
||||
run: npm run build
|
||||
|
||||
# npm trusted publishing (OIDC) does not support Gitea runners, so this uses npm's
|
||||
# documented fallback: a granular access token scoped to this package, with
|
||||
# bypass 2FA and a short expiry.
|
||||
- name: Publish Library
|
||||
run: npm publish --access public
|
||||
env:
|
||||
|
||||
Reference in new issue
Block a user