-
Notifications
You must be signed in to change notification settings - Fork 1
389 lines (344 loc) · 13.2 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
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
name: Release Workbench
on:
release:
types: [published]
defaults:
run:
shell: bash
jobs:
build:
name: Build on ${{ matrix.target }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: [self-hosted, linux, X64]
target: Linux
# M1
- os: macos-14
target: Macos
# X86
- os: macos-13
target: Macos
- os: windows-latest
target: Windows
# - os: "[self-hosted, linux, ARM64]"
# target: Linux
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Change the package.json version to match the tag
run: |
sed -i.bak 's/"version": "[^"]*"/"version": "'"$GITHUB_REF_NAME"'"/' package.json && rm package.json.bak
rm -f package.json.bak
- name: Download CQLSH prebuilt binaries from axonops-workbench-cqlsh
run: |
mkdir -p main/bin
for binary in cqlsh-410 cqlsh-407 keys_generator; do
curl -fL ${CQLSH_GITHUB_URL}/${CQLSH_BUILD_VERSION}/${binary}-$(uname -s)-$(uname -m).tar | tar xf - -C main/bin
mv main/bin/${binary}-$(uname -s)-$(uname -m) main/bin/${binary}
mv main/bin/${binary}/${binary}-$(uname -s)-$(uname -m) main/bin/${binary}/${binary}
done
sed -i.bak "s/%CQLSH_VERSION%/$CQLSH_BUILD_VERSION/g" renderer/views/index.html
rm -f renderer/views/index.html.bak
env:
CQLSH_BUILD_VERSION: "0.11.0"
CQLSH_GITHUB_URL: "${{ secrets.CQLSH_GITHUB_URL || 'https://github.com/axonops/axonops-workbench-cqlsh/releases/download' }}"
- name: Setup Python v3.12
uses: actions/setup-python@v5
with:
python-version: 3.12
cache: "pip"
- name: Install python dependencies
run: pip3 install -r requirements.txt
- name: Setup Node.js v20.17.0
uses: actions/setup-node@v4
with:
node-version: 20.17.0
- name: Get credits and add them to the database
run: |
cd get_credits
npm cache clean --force
npm i
npm rebuild
node get_credits.js
- name: Install AxonOps Developer Workbench dependencies
run: |
npm cache clean --force
npm i
# - name: Install Snapcraft
# uses: samuelmeuli/action-snapcraft@v2
# if: ${{ runner.os != 'Windows' }}
- name: Pack AxonOps Developer Workbench
run: |
if [ "$(uname -m)" == "aarch64" ] && [ "$(uname -s)" == "Linux" ]; then
sudo apt-get -y install ruby
sudo gem install dotenv -v 2.8.1
sudo gem instal fpm
export USE_SYSTEM_FPM=true
fi
if [ "$(uname -s )" == "Darwin" ] && [ "$(uname -m)" == "arm64" ]; then
npm run mac:arm64
elif [ "$(uname -s )" == "Darwin" ] && [ "$(uname -m)" == "x86_64" ]; then
npm run mac
fi
export CSC_IDENTITY_AUTO_DISCOVERY=false
if [ "$(uname -s )" == "Linux" ]; then
npm run linux
fi
if [[ "$(uname -s)" =~ "MINGW64" ]]; then
unset CSC_KEY_PASSWORD
unset CSC_LINK
npm run win
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
CSC_LINK: ${{ secrets.CSC_LINK }}
APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }}
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
CSC_INSTALLER_KEY_PASSWORD: ${{ secrets.CSC_INSTALLER_KEY_PASSWORD }}
CSC_INSTALLER_LINK: ${{ secrets.CSC_INSTALLER_LINK }}
- name: Setup temporary installer signing keychain
uses: apple-actions/import-codesign-certs@v3
if: ${{ startsWith(runner.os, 'macos') }}
with:
p12-file-base64: ${{ secrets.CSC_INSTALLER_LINK }}
p12-password: ${{ secrets.CSC_INSTALLER_KEY_PASSWORD }}
- name: Sign the Apple pkg
if: ${{ startsWith(runner.os, 'macos') }}
run: |
for pkg_name in $(ls -1 dist/*.pkg); do
mv $pkg_name Unsigned-Workbench.pkg
productsign --sign "Developer ID Installer: AXONOPS Limited (UJ776LUP23)" Unsigned-Workbench.pkg $pkg_name
rm -f Unsigned-Workbench.pkg
xcrun notarytool submit $pkg_name --apple-id $APPLE_ID --team-id $APPLE_TEAM_ID --password $APPLE_APP_SPECIFIC_PASSWORD --wait
done
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }}
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
- name: Azure login
if: runner.os == 'Windows'
uses: azure/login@v2
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Install AzureSignTool
if: runner.os == 'Windows'
run: dotnet tool install --no-cache --global AzureSignTool --version 4.0.1
- name: Azure token to use with AzureSignTool
if: runner.os == 'Windows'
shell: pwsh
run: |
$az_token=$(az account get-access-token --scope https://vault.azure.net/.default --query accessToken --output tsv)
echo "::add-mask::$az_token"
echo "AZ_TOKEN=$az_token" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Build signed installer
if: runner.os == 'Windows'
run: |
azuresigntool.exe sign --verbose -kvu ${{ secrets.AZURE_KEY_VAULT_URI }} -kvc ${{ secrets.AZURE_KEYVAULT_CERT_NAME }} -kva %AZ_TOKEN% -fd sha256 -tr http://timestamp.digicert.com -v "dist/AxonOps Workbench-%GITHUB_REF_NAME%-win-x64.exe"
azuresigntool.exe sign --verbose -kvu ${{ secrets.AZURE_KEY_VAULT_URI }} -kvc ${{ secrets.AZURE_KEYVAULT_CERT_NAME }} -kva %AZ_TOKEN% -fd sha256 -tr http://timestamp.digicert.com -v "dist/AxonOps Workbench-%GITHUB_REF_NAME%-win-x64.msi"
shell: cmd
# Ensure this task is right before the Upload
- name: Create checksum files
run: |
SAVEIFS=$IFS
IFS=$(echo -en "\n\b")
cd dist
case "$(uname -s)" in
Darwin)
FILES=$(ls -1 *.dmg *.zip *.pkg)
for f in $FILES; do
shasum -a 256 $f > ${f}.sha256sum
done
;;
MINGW64*)
FILES=$(ls -1 *.exe *.msi)
for f in $FILES; do
sha256sum $f > ${f}.sha256sum
done
;;
Linux)
FILES=$(ls -1 *.tar.gz *.deb *.rpm)
for f in $FILES; do
sha256sum $f > ${f}.sha256sum
done
;;
esac
IFS=$SAVEIFS
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload Artifacts
uses: softprops/action-gh-release@v2
with:
files: |
dist/*.zip
dist/*.pkg
dist/*.dmg
dist/*.deb
dist/*.rpm
dist/*.exe
dist/*.tar.gz
dist/*.nsis
dist/*.msi
dist/*.sha256sum
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Release choco and brew
release-brew:
runs-on: ubuntu-latest
needs: [build]
if: ${{ !cancelled() && success() }}
steps:
- uses: actions/checkout@v4
with:
ref: main
repository: axonops/homebrew-repository
path: homebrew
persist-credentials: true
fetch-depth: 0
ssh-key: ${{ secrets.BREW_SSH_KEY }}
- name: Make changes to Homebrew
run: |
VERSION=$GITHUB_REF_NAME
case $VERSION in
*internal*)
NAME=axonopsworkbench-internal
CONFIG_FILE=Casks/axonopsworkbench-internal.rb
;;
*beta*)
NAME=axonopsworkbench-beta
CONFIG_FILE=Casks/axonopsworkbench-beta.rb
;;
*)
NAME=axonopsworkbench
CONFIG_FILE=Casks/axonopsworkbench.rb
;;
esac
cd homebrew
git config user.name "GitHub Actions"
git config user.email "[email protected]"
# Get the sha256sum
SHA_ARM=$(curl -sfL ${GITHUB_URL}/${VERSION}/AxonOps.Workbench-${VERSION}-mac-arm64.zip.sha256sum | awk '{print $1}')
SHA_AMD=$(curl -sfL ${GITHUB_URL}/${VERSION}/AxonOps.Workbench-${VERSION}-mac-x64.zip.sha256sum | awk '{print $1}')
# Update versions
cp $TEMPLATE $CONFIG_FILE
sed -i "s/%SHA_ARM%/$SHA_ARM/g" $CONFIG_FILE
sed -i "s/%SHA_AMD%/$SHA_AMD/g" $CONFIG_FILE
sed -i "s/%VERSION%/${VERSION}/g" $CONFIG_FILE
sed -i "s/cask \"axonopsworkbench\" do/cask \"${NAME}\" do/g" $CONFIG_FILE
git add $CONFIG_FILE
if [ $(git status --porcelain | wc -l) -eq "0" ]; then
echo "No changes to commit"
exit 0
fi
git --no-pager diff
git commit -m "Changes made by GitHub Actions [skip ci]"
git tag $VERSION
env:
GITHUB_URL: https://github.com/axonops/axonops-workbench-cassandra/releases/download/
TEMPLATE: Casks/axonopsworkbench.rb.tmpl
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
directory: homebrew
repository: axonops/homebrew-repository
ssh: true
tags: true
release-choco:
runs-on: ubuntu-latest
needs: [build]
if: ${{ !cancelled() && success() }}
steps:
- uses: actions/checkout@v4
with:
ref: main
repository: axonops/chocolatey
path: chocolatey
persist-credentials: true
fetch-depth: 0
ssh-key: ${{ secrets.CHOCO_SSH_KEY }}
- name: Make changes to chocolatey
run: |
set -x
VERSION=$GITHUB_REF_NAME
cd chocolatey
git config user.name "GitHub Actions"
git config user.email "[email protected]"
# Get the sha256sum
SHA_AMD=$(curl -sfL ${GITHUB_URL}/${VERSION}/AxonOps.Workbench-${VERSION}-win-x64.exe.sha256sum | awk '{print $1}')
# Update versions
cp $TEMPLATE $CONFIG_FILE
sed -i "s/%SHA_AMD%/$SHA_AMD/g" $CONFIG_FILE
sed -i "s/%VERSION%/${VERSION}/g" $CONFIG_FILE
sed -i "s%<version>.*</version>%<version>${VERSION}</version>%g" axonopsworkbench.nuspec
git add .
if [ $(git status --porcelain | wc -l) -eq "0" ]; then
echo "No changes to commit"
exit 0
fi
git --no-pager diff
git commit -m "Changes made by GitHub Actions"
git tag $VERSION
env:
GITHUB_URL: https://github.com/axonops/axonops-workbench-cassandra/releases/download/
TEMPLATE: tools/chocolateyinstall.ps1.tmpl
CONFIG_FILE: tools/chocolateyinstall.ps1
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
directory: chocolatey
repository: axonops/chocolatey
ssh: true
tags: true
release-debian-redhat:
runs-on: ubuntu-latest
needs: [build]
if: ${{ !cancelled() && success() }}
steps:
- id: "auth"
uses: "google-github-actions/auth@v1"
with:
credentials_json: "${{ secrets.SERVICE_ACCOUNT_KEY }}"
- name: "Set up Cloud SDK"
uses: "google-github-actions/setup-gcloud@v1"
- name: "Set runtime variables"
run: |
PUBLISH="yes"
DEBIAN_ARCHS="amd64"
REDHAT_ARCHS="x86_64"
case $VERSION in
*internal*)
PUBLISH="no"
REPO_SUFFIX="-beta"
;;
*beta*)
REPO_SUFFIX="-beta"
;;
*)
REPO_SUFFIX=""
;;
esac
echo "REPO=$REPO" >> $GITHUB_ENV
echo "DEBIAN_ARCHS=$DEBIAN_ARCHS" >> $GITHUB_ENV
echo "REDHAT_ARCHS=$REDHAT_ARCHS" >> $GITHUB_ENV
- name: Push Debian package
if: env.PUBLISH == 'yes'
run: |
for arch in ${{ env.DEBIAN_ARCHS }}; do
curl -sLO "https://github.com/axonops/axonops-workbench-cassandra/releases/download/$GITHUB_REF_NAME/AxonOps.Workbench-$GITHUB_REF_NAME-linux-${arch}.deb"
gcloud config set project axonops-public
gcloud artifacts apt upload axonops-apt-${env.REPO_SUFFIX} --location=europe --source=AxonOps.Workbench-$GITHUB_REF_NAME-linux-${arch}.deb
done
- name: Push RedHat package
if: env.PUBLISH == 'yes'
run: |
for arch in ${{ env.REDHAT_ARCHS }}; do
curl -sLO "https://github.com/axonops/axonops-workbench-cassandra/releases/download/$GITHUB_REF_NAME/AxonOps.Workbench-$GITHUB_REF_NAME-linux-${arch}.rpm"
gcloud config set project axonops-public
gcloud artifacts yum upload axonops-yum-${env.REPO_SUFFIX} --location=europe --source=AxonOps.Workbench-$GITHUB_REF_NAME-linux-${arch}.rpm
done