Skip to content

Commit cf7c532

Browse files
author
Fabiana Severin
committed
Changing permissions position, node version, npm token, check-headers
1 parent 61c7c17 commit cf7c532

File tree

1 file changed

+19
-7
lines changed

1 file changed

+19
-7
lines changed

.github/workflows/build-and-release.yml

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ on:
88
branches: [ main ]
99
workflow_dispatch:
1010

11-
permissions:
12-
id-token: write
13-
contents: read
11+
permissions: {}
1412

1513
jobs:
1614
get-version:
1715
runs-on: ubuntu-latest
16+
permissions:
17+
contents: read
1818
outputs:
1919
version: ${{ steps.version.outputs.version }}
2020
steps:
@@ -28,6 +28,9 @@ jobs:
2828
build:
2929
needs: [get-version]
3030
timeout-minutes: 30
31+
permissions:
32+
id-token: write
33+
contents: read
3134
strategy:
3235
matrix:
3336
include:
@@ -42,7 +45,10 @@ jobs:
4245
- name: Setup Node.js
4346
uses: actions/setup-node@v4
4447
with:
45-
node-version: '20'
48+
node-version: 'lts/*'
49+
50+
- name: Check copyright headers
51+
run: npm run check-headers
4652

4753
- name: Install build dependencies
4854
run: |
@@ -92,6 +98,8 @@ jobs:
9298

9399
test:
94100
needs: [get-version, build]
101+
permissions:
102+
contents: read
95103
strategy:
96104
matrix:
97105
node-version: [18, 20, 22]
@@ -109,14 +117,18 @@ jobs:
109117
docker build \
110118
-f test/unit/Dockerfile.nodejs${{ matrix.node-version }}.x \
111119
-t unit/nodejs.${{ matrix.node-version }}x \
112-
.
120+
. || (sleep 60 && docker build \
121+
-f test/unit/Dockerfile.nodejs${{ matrix.node-version }}.x \
122+
-t unit/nodejs.${{ matrix.node-version }}x \
123+
.)
113124
docker run --rm unit/nodejs.${{ matrix.node-version }}x
114125
115126
publish:
116127
if: startsWith(github.ref, 'refs/tags/')
117128
runs-on: codebuild-project-awsaws-lambda-nodejs-runtime-interface-client-${{ github.run_id }}-${{ github.run_attempt }}
118129
needs: [get-version, build, test]
119130
permissions:
131+
id-token: write
120132
contents: write
121133
steps:
122134
- uses: actions/checkout@v4
@@ -136,11 +148,11 @@ jobs:
136148
- name: Setup Node.js
137149
uses: actions/setup-node@v4
138150
with:
139-
node-version: '20'
151+
node-version: 'lts/*'
140152

141153
- name: Setup NPM authentication
142154
run: |
143-
NPM_TOKEN=$(aws secretsmanager get-secret-value --secret-id aws-lambda-runtimes/github/nodejs/npm-token --query SecretString --output text)
155+
NPM_TOKEN=$(aws secretsmanager get-secret-value --secret-id ${{ secrets.NPM_SECRET_NAME }} --query SecretString --output text)
144156
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > .npmrc
145157
chmod 0600 .npmrc
146158

0 commit comments

Comments
 (0)