Skip to content

Commit ca9131e

Browse files
authored
chore: harden release workflow for supply-chain security (#5113)
1 parent 9c3523f commit ca9131e

6 files changed

Lines changed: 10344 additions & 19 deletions

File tree

.github/dependabot.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: github-actions
4+
directory: /
5+
schedule:
6+
interval: weekly

.github/workflows/checks.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,17 @@ on:
33
- push
44
- pull_request
55
- workflow_call
6+
permissions:
7+
contents: read
8+
69
jobs:
710
test:
8-
uses: adonisjs/core/.github/workflows/test.yml@7.x
11+
uses: adonisjs/core/.github/workflows/test.yml@3605cb1dc67afb14f818a3d3a7214991d262c336 # 7.x
912
with:
1013
install-pnpm: true
1114

1215
lint:
13-
uses: adonisjs/.github/.github/workflows/lint.yml@main
16+
uses: adonisjs/.github/.github/workflows/lint.yml@7eeb68b240344601ced8ef4fbe0b4dd31df0760b # main
1417

1518
typecheck:
16-
uses: adonisjs/.github/.github/workflows/typecheck.yml@main
19+
uses: adonisjs/.github/.github/workflows/typecheck.yml@7eeb68b240344601ced8ef4fbe0b4dd31df0760b # main

.github/workflows/release.yml

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,46 @@
11
name: release
22
on: workflow_dispatch
3+
34
permissions:
4-
contents: write
5-
id-token: write
5+
contents: read
6+
7+
concurrency:
8+
group: release
9+
cancel-in-progress: false
10+
611
jobs:
712
checks:
13+
permissions:
14+
contents: read
815
uses: ./.github/workflows/checks.yml
16+
secrets: inherit
17+
918
release:
1019
needs: checks
1120
runs-on: ubuntu-latest
21+
environment: npm-publish
22+
permissions:
23+
contents: write
24+
id-token: write
1225
steps:
13-
- uses: actions/checkout@v4
26+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
1427
with:
1528
fetch-depth: 0
1629

17-
- uses: actions/setup-node@v4
30+
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
1831
with:
1932
node-version: 24
33+
registry-url: 'https://registry.npmjs.org'
2034

2135
- name: git config
2236
run: |
2337
git config user.name "${GITHUB_ACTOR}"
2438
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
2539
26-
- name: Init npm config
27-
run: npm config set //registry.npmjs.org/:_authToken $NPM_TOKEN
28-
env:
29-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
40+
- run: npm install --ignore-scripts
3041

31-
- run: npm install
42+
- run: npm audit signatures
3243

3344
- run: npm run release -- --ci
3445
env:
35-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
3646
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
37-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.github/workflows/test.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ on:
1212
default: false
1313
required: false
1414

15+
permissions:
16+
contents: read
17+
1518
jobs:
1619
test_linux:
1720
runs-on: ubuntu-latest
@@ -21,10 +24,10 @@ jobs:
2124

2225
steps:
2326
- name: Checkout code
24-
uses: actions/checkout@v4
27+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
2528

2629
- name: Setup Node.js
27-
uses: actions/setup-node@v4
30+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
2831
with:
2932
node-version: ${{ matrix.node-version }}
3033

@@ -49,10 +52,10 @@ jobs:
4952

5053
steps:
5154
- name: Checkout code
52-
uses: actions/checkout@v4
55+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
5356

5457
- name: Setup Node.js
55-
uses: actions/setup-node@v4
58+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
5659
with:
5760
node-version: ${{ matrix.node-version }}
5861

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ build
1111
dist
1212
yarn.lock
1313
shrinkwrap.yaml
14-
package-lock.json
1514
test/__app
1615
.env
1716
backup

0 commit comments

Comments
 (0)