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:
|
permissions:
|
||||||
contents: write
|
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:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
if: gitea.ref == 'refs/heads/main'
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Repository
|
- name: Checkout Repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
fetch-tags: true
|
fetch-tags: true
|
||||||
|
|
||||||
- name: Use Node.js 24.17.0
|
- name: Use Node.js 24.17.0
|
||||||
uses: actions/setup-node@v6
|
uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6.5.0
|
||||||
with:
|
with:
|
||||||
node-version: '24.17.0'
|
node-version: '24.17.0'
|
||||||
registry-url: 'https://registry.npmjs.org'
|
registry-url: 'https://registry.npmjs.org'
|
||||||
@@ -27,6 +33,9 @@ jobs:
|
|||||||
- name: Install Dependencies
|
- name: Install Dependencies
|
||||||
run: npm ci
|
run: npm ci
|
||||||
|
|
||||||
|
- name: Run Checks
|
||||||
|
run: npm run check
|
||||||
|
|
||||||
- name: Set Release Version
|
- name: Set Release Version
|
||||||
run: npm run version:place
|
run: npm run version:place
|
||||||
env:
|
env:
|
||||||
@@ -41,6 +50,9 @@ jobs:
|
|||||||
- name: Run Build
|
- name: Run Build
|
||||||
run: npm 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
|
- name: Publish Library
|
||||||
run: npm publish --access public
|
run: npm publish --access public
|
||||||
env:
|
env:
|
||||||
|
|||||||
Reference in new issue
Block a user