-
Notifications
You must be signed in to change notification settings - Fork 1
316 lines (291 loc) · 9.46 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
name: Release
on:
push:
tags:
- 'v*'
permissions:
id-token: write
contents: write
defaults:
run:
shell: bash
jobs:
release-jvm:
name: Release JVM
runs-on: ubuntu-latest
timeout-minutes: 10
env:
JAVA_OPTS: "-Xmx4G"
SBT_OPTS: "-Dsbt.ci=true"
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '21'
- name: Prepare environment
env:
SONATYPE_SBT: ${{ secrets.SONATYPE_SBT }}
SONATYPE_PGP_SECRET: ${{ secrets.SONATYPE_PGP_SECRET }}
run: |
mkdir --parents ~/.sbt/1.0 || true
echo "$SONATYPE_SBT" > ~/.sbt/1.0/sonatype.sbt
echo -n "$SONATYPE_PGP_SECRET" | base64 --decode | gpg --batch --import
- name: Deploy Java adapter
id: deploy-jvm
env:
PGP_PASSPHRASE: ${{ secrets.SONATYPE_PGP_PASSPHRASE }}
working-directory: ./jvm
run: |
sbt "project gatling-jvm-to-js-adapter" "release with-defaults"
- name: Setup version
id: version
run: |
version="$(cat jvm/adapter/target/release-info)"
echo "version=$version"
echo "version=$version" >> $GITHUB_OUTPUT
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: release-jvm-workdir
path: .
include-hidden-files: true
retention-days: 7
release-js:
name: Release JS
needs: release-jvm
runs-on: ubuntu-latest
timeout-minutes: 10
environment:
name: npm
url: https://www.npmjs.com/org/gatling.io
steps:
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: release-jvm-workdir
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
- name: Deploy JS packages
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
working-directory: ./js
run: |
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > .npmrc
npm ci
npm version "${{ needs.release-jvm.outputs.version }}"
npm run build --workspaces
for pkg in "cli" "jvm-types" "core" "http"; do
cp ../LICENSE "./$pkg/LICENSE"
npm publish --access public "[email protected]/$pkg"
done
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: release-js-workdir
path: .
include-hidden-files: true
retention-days: 7
create-github-release:
name: Create GitHub release (draft)
needs:
- release-jvm
- release-js
runs-on: ubuntu-latest
timeout-minutes: 2
environment:
name: GitHub release (draft)
url: ${{ steps.release.outputs.html_url }}
outputs:
prerelease: ${{ steps.release.outputs.prerelease }}
upload_url: ${{ steps.release.outputs.upload_url }}
steps:
- name: Create GitHub release (draft)
id: release
run: |
version="${{ needs.release-jvm.outputs.version }}"
if [[ "$version" =~ -M[0-9]+$ ]]; then
prerelease=true
else
prerelease=false
fi
echo "prerelease=$prerelease"
echo "prerelease=$prerelease" >> $GITHUB_OUTPUT
releases_url=$(echo "${{ github.event.repository.releases_url }}" | sed 's/{\/id}//')
response=$(curl \
--location \
--silent \
--show-error \
--request POST \
--header "Accept: application/vnd.github+json" \
--header "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
--header "X-GitHub-Api-Version: 2022-11-28" \
"$releases_url" \
--data @- <<EOF
{
"name": "Gatling JS $version",
"tag_name": "${{ github.ref_name }}",
"body": "To get started with Gatling JS, please check [the tutorial](https://docs.gatling.io/tutorials/scripting-intro-js/).\n\nThe bundle files in this release are normally automatically downloaded by the Gatling JS CLI. If you need to perform a manual install, please refer to [the documentation](https://docs.gatling.io/reference/integrations/build-tools/js-cli/).",
"draft": true,
"prerelease": $prerelease
}
EOF
)
echo "response=$response"
html_url=$(echo "$response" | jq --raw-output ".html_url")
echo "html_url=$html_url"
echo "html_url=$html_url" >> $GITHUB_OUTPUT
upload_url=$(echo "$response" | jq --raw-output ".upload_url")
echo "upload_url=$upload_url"
echo "upload_url=$upload_url" >> $GITHUB_OUTPUT
build-linux-x64:
name: Build bundle for Linux x64
needs:
- release-jvm
- create-github-release
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: release-js-workdir
- name: Build and upload bundle
uses: ./.github/actions/build-and-upload-bundle
with:
version: ${{ needs.release-jvm.outputs.version }}
upload-url: ${{ needs.create-github-release.outputs.upload_url }}
os-type: Linux
os-arch: x64
github-token: ${{ secrets.GITHUB_TOKEN }}
build-linux-arm64:
name: Build bundle for Linux ARM64
needs:
- release-jvm
- create-github-release
runs-on: ubuntu-24-arm-2-cores
timeout-minutes: 5
steps:
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: release-js-workdir
- name: Build and upload bundle
uses: ./.github/actions/build-and-upload-bundle
with:
version: ${{ needs.release-jvm.outputs.version }}
upload-url: ${{ needs.create-github-release.outputs.upload_url }}
os-type: Linux
os-arch: arm64
github-token: ${{ secrets.GITHUB_TOKEN }}
build-macos-x64:
name: Build bundle for macOS x64
needs:
- release-jvm
- create-github-release
runs-on: macos-13
timeout-minutes: 5
steps:
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: release-js-workdir
- name: Build and upload bundle
uses: ./.github/actions/build-and-upload-bundle
with:
version: ${{ needs.release-jvm.outputs.version }}
upload-url: ${{ needs.create-github-release.outputs.upload_url }}
os-type: Darwin
os-arch: x64
github-token: ${{ secrets.GITHUB_TOKEN }}
build-macos-arm64:
name: Build bundle for macOS ARM64
needs:
- release-jvm
- create-github-release
runs-on: macos-14
timeout-minutes: 5
steps:
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: release-js-workdir
- name: Build and upload bundle
uses: ./.github/actions/build-and-upload-bundle
with:
version: ${{ needs.release-jvm.outputs.version }}
upload-url: ${{ needs.create-github-release.outputs.upload_url }}
os-type: Darwin
os-arch: arm64
github-token: ${{ secrets.GITHUB_TOKEN }}
build-windows-x64:
name: Build bundle for Windows x64
needs:
- release-jvm
- create-github-release
runs-on: windows-latest
timeout-minutes: 5
steps:
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: release-js-workdir
- name: Build and upload bundle
uses: ./.github/actions/build-and-upload-bundle
with:
version: ${{ needs.release-jvm.outputs.version }}
upload-url: ${{ needs.create-github-release.outputs.upload_url }}
os-type: Windows_NT
os-arch: x64
github-token: ${{ secrets.GITHUB_TOKEN }}
publish-github-release:
name: Publish GitHub release
needs:
- create-github-release
- build-linux-x64
- build-linux-arm64
- build-macos-x64
- build-macos-arm64
- build-windows-x64
runs-on: ubuntu-latest
timeout-minutes: 2
environment:
name: GitHub release
url: ${{ steps.release.outputs.html_url }}
steps:
- name: Publish GitHub release
id: release
run: |
prerelease="${{ needs.create-github-release.outputs.prerelease }}"
if [[ "$prerelease" = "true" ]]; then
make_latest=false
else
make_latest=true
fi
releases_url=$(echo "${{ github.event.repository.releases_url }}" | sed 's/{\/id}//')
response=$(curl \
--location \
--silent \
--show-error \
--request PATCH \
--header "Accept: application/vnd.github+json" \
--header "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
--header "X-GitHub-Api-Version: 2022-11-28" \
"$releases_url" \
--data @- <<EOF
{
"draft": false,
"make_latest": $make_latest
}
EOF
)
echo "response=$response"
html_url=$(echo "$response" | jq --raw-output ".html_url")
echo "html_url=$html_url"
echo "html_url=$html_url" >> $GITHUB_OUTPUT