@@ -3,9 +3,20 @@ name: Build and Release
3
3
on :
4
4
push :
5
5
branches : [ fabisev/artifact-publishing ]
6
- tags : [ 'v*' ]
6
+ tags : [ 'v*', 'rc-*' ]
7
7
pull_request :
8
8
branches : [ main ]
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
9
20
10
21
jobs :
11
22
lint :
88
99
run : |
89
100
docker build -f test/unit/Dockerfile.nodejs${{ matrix.node-version }}.x -t unit/nodejs.${{ matrix.node-version }}x .
90
101
docker run --rm unit/nodejs.${{ matrix.node-version }}x
91
-
92
-
93
102
94
103
publish :
95
- if : startsWith(github.ref, 'refs/tags/v ')
104
+ if : startsWith(github.ref, 'refs/tags/')
96
105
runs-on : ubuntu-latest
97
106
needs : [build, test]
98
107
permissions :
@@ -114,10 +123,31 @@ jobs:
114
123
uses : actions/setup-node@v4
115
124
with :
116
125
node-version : ' 20'
117
- registry-url : ' https://registry.npmjs.org'
118
126
127
+ # Handle release candidate version if needed
128
+ - name : Determine version
129
+ id : version
130
+ run : |
131
+ if [[ "${{ github.ref }}" == refs/tags/rc-* ]]; then
132
+ RC_NUMBER=${GITHUB_REF#refs/tags/rc-}
133
+ PACKAGE_VERSION="${{ needs.build.outputs.version }}-rc.${RC_NUMBER}"
134
+ echo "package_version=$PACKAGE_VERSION" >> $GITHUB_OUTPUT
135
+ echo "is_rc=true" >> $GITHUB_OUTPUT
136
+ # Update package.json version to include RC suffix
137
+ npm version $PACKAGE_VERSION --no-git-tag-version
138
+ else
139
+ echo "package_version=${{ needs.build.outputs.version }}" >> $GITHUB_OUTPUT
140
+ echo "is_rc=false" >> $GITHUB_OUTPUT
141
+ fi
142
+
143
+ # Commented out npm publishing until token is available
119
144
# - name: Publish to npm
120
- # run: npm publish aws-lambda-ric-*.tgz
145
+ # run: |
146
+ # if [[ "${{ steps.version.outputs.is_rc }}" == "true" ]]; then
147
+ # npm publish aws-lambda-ric-*.tgz --tag rc
148
+ # else
149
+ # npm publish aws-lambda-ric-*.tgz
150
+ # fi
121
151
# env:
122
152
# NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
123
153
@@ -129,4 +159,50 @@ jobs:
129
159
checksums.sha256
130
160
checksums.sha512
131
161
checksums.txt
132
- generate_release_notes : true
162
+ prerelease : ${{ steps.version.outputs.is_rc }}
163
+ name : ${{ steps.version.outputs.is_rc == 'true' && format('Release Candidate {0}', steps.version.outputs.package_version) || '' }}
164
+ generate_release_notes : true
165
+
166
+ test-publish :
167
+ if : github.event_name == 'workflow_dispatch' && github.event.inputs.test_mode != 'none'
168
+ runs-on : ubuntu-latest
169
+ needs : [build, test]
170
+ steps :
171
+ - uses : actions/checkout@v4
172
+
173
+ - name : Download artifacts
174
+ uses : actions/download-artifact@v4
175
+ with :
176
+ name : package-${{ needs.build.outputs.version }}
177
+
178
+ - name : Verify checksums
179
+ run : |
180
+ sha256sum -c checksums.sha256
181
+ sha512sum -c checksums.sha512
182
+
183
+ - name : Setup Node.js
184
+ uses : actions/setup-node@v4
185
+ with :
186
+ node-version : ' 20'
187
+
188
+ - name : Test Release Publishing
189
+ if : github.event.inputs.test_mode == 'release'
190
+ run : |
191
+ echo "=== TESTING RELEASE PUBLISHING (DRY RUN) ==="
192
+ echo "Would create a GitHub release with the following files:"
193
+ ls -la aws-lambda-ric-*.tgz checksums.*
194
+ echo "\nRelease would include version: ${{ needs.build.outputs.version }}"
195
+
196
+ - name : Test RC Publishing
197
+ if : github.event.inputs.test_mode == 'rc'
198
+ run : |
199
+ echo "=== TESTING RC PUBLISHING (DRY RUN) ==="
200
+ # Simulate RC version
201
+ RC_NUMBER="1"
202
+ PACKAGE_VERSION="${{ needs.build.outputs.version }}-rc.${RC_NUMBER}"
203
+ echo "Would create a GitHub pre-release with the following files:"
204
+ ls -la aws-lambda-ric-*.tgz checksums.*
205
+ echo "\nRelease would include version: ${PACKAGE_VERSION}"
206
+
207
+ # Update version for display purposes
208
+ npm version ${PACKAGE_VERSION} --no-git-tag-version
0 commit comments