7
7
pull_request :
8
8
branches : [ main ]
9
9
workflow_dispatch :
10
- inputs :
11
- test_mode :
12
- description : ' Test mode (release, rc, or none)'
13
- required : true
14
- default : ' none'
15
- type : choice
16
- options :
17
- - none
18
- - release
19
- - rc
20
10
21
11
jobs :
22
- # Commenting out lint job as it's failing
23
- # lint:
24
- # runs-on: ubuntu-latest
25
- # steps:
26
- # - uses: actions/checkout@v4
27
- # - name: Setup Node.js
28
- # uses: actions/setup-node@v4
29
- # with:
30
- # node-version: '20'
31
- # cache: 'npm'
32
- # - name: Install and lint
33
- # run: |
34
- # npm ci
35
- # npm run lint
36
- # npm run format
37
-
38
12
build :
39
13
runs-on :
40
- - codebuild-awsaws-lambda-nodejs-runtime-interface-client-${{ github.run_id }}-${{ github.run_attempt }}
41
- # Removed dependency on lint job
14
+ - project-awsaws-lambda-nodejs-runtime-interface-client
42
15
outputs :
43
16
version : ${{ steps.version.outputs.version }}
44
17
steps :
54
27
id : version
55
28
run : |
56
29
BASE_VERSION=$(node -p "require('./package.json').version")
57
- VERSION="${BASE_VERSION}"
58
- echo "version=$VERSION" >> $GITHUB_OUTPUT
30
+ echo "version=$BASE_VERSION" >> $GITHUB_OUTPUT
59
31
60
32
- name : Cache native dependencies
61
33
uses : actions/cache@v4
@@ -66,26 +38,24 @@ jobs:
66
38
key : native-deps-${{ runner.os }}-${{ hashFiles('deps/versions', 'binding.gyp') }}
67
39
68
40
- name : Install build dependencies
69
- run : |
70
- yum install -y cmake make gcc-c++
41
+ run : yum install -y cmake make gcc-c++
71
42
72
43
- name : Clean build directories
73
- run : |
74
- rm -rf deps/*/build
44
+ run : rm -rf deps/*/build
75
45
76
46
- name : Install and build
77
47
run : |
78
48
npm ci
79
49
npm run build
80
50
npm pack
81
51
82
- - name : Generate checksums and signatures
52
+ - name : Generate checksums
83
53
run : |
84
54
PACKAGE_FILE=$(ls aws-lambda-ric-*.tgz)
85
55
sha256sum $PACKAGE_FILE > checksums.sha256
86
56
sha512sum $PACKAGE_FILE > checksums.sha512
87
57
cat checksums.sha256 checksums.sha512 > checksums.txt
88
- echo "Package: $PACKAGE_FILE with version prefix : ${{ steps.version.outputs.version }}" >> checksums.txt
58
+ echo "Package: $PACKAGE_FILE with version: ${{ steps.version.outputs.version }}" >> checksums.txt
89
59
90
60
- name : Upload artifacts
91
61
uses : actions/upload-artifact@v4
98
68
99
69
test :
100
70
runs-on :
101
- - codebuild -awsaws-lambda-nodejs-runtime-interface-client-${{ github.run_id }}-${{ github.run_attempt }}
71
+ - project -awsaws-lambda-nodejs-runtime-interface-client
102
72
needs : [build]
103
73
strategy :
104
74
matrix :
112
82
docker run --rm unit/nodejs.${{ matrix.node-version }}x
113
83
114
84
publish :
115
- if : startsWith(github.ref, 'refs/tags/')
85
+ if : startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/fabisev/artifact-publishing'
116
86
runs-on :
117
- - codebuild -awsaws-lambda-nodejs-runtime-interface-client-${{ github.run_id }}-${{ github.run_attempt }}
87
+ - project -awsaws-lambda-nodejs-runtime-interface-client
118
88
needs : [build, test]
119
89
permissions :
120
90
contents : write
@@ -136,52 +106,60 @@ jobs:
136
106
with :
137
107
node-version : ' 20'
138
108
139
- # Handle release candidate version if needed
140
- - name : Determine version
109
+ - name : Setup NPM authentication
110
+ run : |
111
+ NPM_TOKEN=$(aws secretsmanager get-secret-value --secret-id aws-lambda-runtimes/github/nodejs/npm-token --query SecretString --output text)
112
+ echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
113
+
114
+ - name : Determine version and package name
141
115
id : version
142
116
run : |
143
- if [[ "${{ github.ref }}" == refs/tags/rc-* ]]; then
117
+ if [[ "${{ github.ref }}" == refs/heads/fabisev/artifact-publishing ]]; then
118
+ # For branch testing, use a scoped package name and test version
119
+ PACKAGE_VERSION="${{ needs.build.outputs.version }}-test.$(date +%s)"
120
+ echo "package_version=$PACKAGE_VERSION" >> $GITHUB_OUTPUT
121
+ echo "is_test=true" >> $GITHUB_OUTPUT
122
+ echo "is_rc=false" >> $GITHUB_OUTPUT
123
+ # Change package name to avoid conflicts
124
+ npm pkg set name="avocado-toast"
125
+ npm version $PACKAGE_VERSION --no-git-tag-version
126
+ elif [[ "${{ github.ref }}" == refs/tags/rc-* ]]; then
144
127
RC_NUMBER=${GITHUB_REF#refs/tags/rc-}
145
128
PACKAGE_VERSION="${{ needs.build.outputs.version }}-rc.${RC_NUMBER}"
146
129
echo "package_version=$PACKAGE_VERSION" >> $GITHUB_OUTPUT
130
+ echo "is_test=false" >> $GITHUB_OUTPUT
147
131
echo "is_rc=true" >> $GITHUB_OUTPUT
148
- # Update package.json version to include RC suffix
149
132
npm version $PACKAGE_VERSION --no-git-tag-version
150
133
else
151
134
echo "package_version=${{ needs.build.outputs.version }}" >> $GITHUB_OUTPUT
135
+ echo "is_test=false" >> $GITHUB_OUTPUT
152
136
echo "is_rc=false" >> $GITHUB_OUTPUT
153
137
fi
154
138
155
- # Commented out npm publishing until token is available
156
- # - name: Publish to npm
157
- # run: |
158
- # if [[ "${{ steps.version.outputs.is_rc }}" == "true" ]]; then
159
- # npm publish aws-lambda-ric-*.tgz --tag rc
160
- # else
161
- # npm publish aws-lambda-ric-*.tgz
162
- # fi
163
- # env:
164
- # NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
139
+ - name : Publish to npm
140
+ run : |
141
+ if [[ "${{ steps.version.outputs.is_test }}" == "true" ]]; then
142
+ npm publish aws-lambda-ric-*.tgz --tag test
143
+ elif [[ "${{ steps.version.outputs.is_rc }}" == "true" ]]; then
144
+ npm publish aws-lambda-ric-*.tgz --tag rc
145
+ else
146
+ npm publish aws-lambda-ric-*.tgz
147
+ fi
165
148
166
149
- name : Generate and Update Changelog
150
+ if : startsWith(github.ref, 'refs/tags/')
167
151
run : |
168
- # Generate changelog entry for this release
169
152
node scripts/generate-changelog.js --output release-notes.md
170
-
171
- # Update RELEASE.CHANGELOG.md with the new entry
172
153
node scripts/generate-changelog.js --update
173
-
174
- # Commit the updated changelog
175
154
git config --local user.email "[email protected] "
176
155
git config --local user.name "GitHub Action"
177
156
git add RELEASE.CHANGELOG.md
178
157
git commit -m "Update changelog for ${{ steps.version.outputs.package_version }}" || echo "No changes to commit"
179
-
180
- # Show the generated release notes
181
158
echo "Generated release notes:"
182
159
cat release-notes.md
183
160
184
161
- name : Create GitHub Release
162
+ if : startsWith(github.ref, 'refs/tags/')
185
163
uses : softprops/action-gh-release@v2
186
164
with :
187
165
files : |
@@ -192,75 +170,3 @@ jobs:
192
170
prerelease : ${{ steps.version.outputs.is_rc }}
193
171
name : ${{ steps.version.outputs.is_rc == 'true' && format('Release Candidate {0}', steps.version.outputs.package_version) || '' }}
194
172
body_path : release-notes.md
195
-
196
- test-publish :
197
- if : (github.event_name == 'workflow_dispatch' && github.event.inputs.test_mode != 'none') || github.ref == 'refs/heads/fabisev/artifact-publishing'
198
- runs-on :
199
- - codebuild-awsaws-lambda-nodejs-runtime-interface-client-${{ github.run_id }}-${{ github.run_attempt }}
200
- needs : [build, test]
201
- steps :
202
- - uses : actions/checkout@v4
203
-
204
- - name : Download artifacts
205
- uses : actions/download-artifact@v4
206
- with :
207
- name : package-${{ needs.build.outputs.version }}
208
-
209
- - name : Verify checksums
210
- run : |
211
- sha256sum -c checksums.sha256
212
- sha512sum -c checksums.sha512
213
-
214
- - name : Setup Node.js
215
- uses : actions/setup-node@v4
216
- with :
217
- node-version : ' 20'
218
-
219
- - name : Get NPM token from AWS Secrets Manager
220
- run : |
221
- NPM_TOKEN=$(aws secretsmanager get-secret-value --secret-id aws-lambda-runtimes/github/nodejs/npm-token --query SecretString --output text | jq -r .token)
222
- echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
223
- echo "registry=https://registry.npmjs.org/" >> ~/.npmrc
224
- echo "Authenticated as: $(npm whoami)"
225
-
226
- - name : Test Release Publishing
227
- if : github.event.inputs.test_mode == 'release' || github.ref == 'refs/heads/fabisev/artifact-publishing'
228
- run : |
229
- echo "=== TESTING RELEASE PUBLISHING ==="
230
- # Extract and modify package for testing
231
- tar -xzf aws-lambda-ric-*.tgz
232
- cd package
233
-
234
- PACKAGE_NAME="icecream-shop"
235
- npm pkg set name="${PACKAGE_NAME}"
236
-
237
- echo "Package name: ${PACKAGE_NAME}"
238
- echo "Publishing to npm with version: ${{ needs.build.outputs.version }}"
239
-
240
- if ! npm publish --access public; then
241
- echo "❌ Publish failed, showing debug logs:"
242
- echo "=== NPM DEBUG LOG ==="
243
- find /root/.npm/_logs -name "*debug*.log" -exec cat {} \; 2>/dev/null || echo "No debug logs found"
244
- echo "=== END DEBUG LOG ==="
245
- exit 1
246
- fi
247
-
248
- echo "✅ Successfully published test package to npm!"
249
-
250
- - name : Test RC Publishing
251
- if : github.event.inputs.test_mode == 'rc'
252
- run : |
253
- echo "=== TESTING RC PUBLISHING ==="
254
- # Extract and modify package for testing
255
- tar -xzf aws-lambda-ric-*.tgz
256
- cd package
257
- PACKAGE_NAME="icecream-shop"
258
- npm pkg set name=PACKAGE_NAME
259
- # Simulate RC version
260
- RC_NUMBER="1"
261
- PACKAGE_VERSION="${{ needs.build.outputs.version }}-rc.${RC_NUMBER}"
262
- echo "Publishing RC to npm with version: ${PACKAGE_VERSION}"
263
- # Update version for RC
264
- npm version ${PACKAGE_VERSION} --no-git-tag-version
265
- npm publish --tag rc --access public
266
- echo "✅ Successfully published RC test package to npm!"
0 commit comments