345 lines (302 loc) · 11.8 KB
/
github-travis.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
# This workflow will build a package using Maven and then publish it to GitHub packages when a release is created
# For more information see: https://github.com/actions/setup-java#apache-maven-with-a-settings-path
name: Github Travis
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [ GAMA_1.8.2 ]
schedule:
- cron: "0 0 * * *"
workflow_dispatch: # For manual trigger
jobs:
#
# GENERIC BUILD
#
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Adopt OpenJDK 17
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: '17'
java-package: jdk
- name: Prepare build
run: |
echo "MAVEN_OPTS='-Dorg.slf4j.simpleLogger.defaultLogLevel=error -XX:+TieredCompilation -XX:TieredStopAtLevel=1 -Xmx2048m'" >> ~/.mavenrc
sudo chmod +x $GITHUB_WORKSPACE/travis/*.sh
- name: Build with Maven
shell: bash
run: $GITHUB_WORKSPACE/travis/compile.sh
env:
MSG: ${ github.event.head_commit.message }
- name: Validate and test Maven
shell: bash
run: $GITHUB_WORKSPACE/travis/validate_and_test.sh
env:
MSG: ${ github.event.head_commit.message }
- name: Check if should release version
run: |
if [[ "${{ github.event_name }}" == "workflow_dispatch" || "${{ github.event.head_commit.message }}" == *"ci release"* ]]; then
echo "The action will continue and create a release"
echo "CONTINUE=true" >> $GITHUB_ENV
else
echo "The action will nicely stop now"
echo "CONTINUE=false" >> $GITHUB_ENV
./travis/publish.sh
fi
echo ${{ env.CONTINUE }}
env:
SSH_USER_PWD: ${{ secrets.USER_PWD }}
SSH_HOST: ${{ secrets.SSH_HOST }}
MSG: ${{ env.TRAVIS_MSG }}
GITHUB_TOKEN: ${{ github.token }}
SSHPASS: ${{ secrets.USER_PWD }}
BOT_TOKEN: ${{ secrets.BOT_TOKEN }}
TRAVIS_COMMIT: ${ GITHUB_SHA }
TRAVIS_EVENT_TYPE: ${{ github.event_name }}
thePATH: "${{ github.workspace }}/Gama1.7"
- name: Make zip file
if: env.CONTINUE == 'true'
shell: bash
run: $GITHUB_WORKSPACE/travis/zip_withjdk.sh
env:
MSG: ${ github.event.head_commit.message }
# cf https://github.com/actions/upload-artifact/issues/246
- name: Move artefacts to root tree
if: env.CONTINUE == 'true'
run: |
# MacOS Family
mv ${{ github.workspace }}/ummisco.gama.product/target/products/Gama*zip ${{ github.workspace }}
mv ${{ github.workspace }}/travis/mac-sign.sh ${{ github.workspace }}
mv ${{ github.workspace }}/ummisco.gama.product/extraresources/installer/windows/* ${{ github.workspace }}
# Debian Family
mv Gama1.7-linux.gtk.x86_64.zip gama-platform_1.8.2-1_amd64.zip
mv Gama1.7-linux.gtk.x86_64_withJDK.zip gama-platform-jdk_1.8.2-1_amd64.zip
- uses: actions/upload-artifact@v2
if: env.CONTINUE == 'true'
with:
name: gama-mac-unsigned
path: |
./Gama1.7-macosx*zip
./mac-sign.sh
- uses: actions/upload-artifact@v2
if: env.CONTINUE == 'true'
with:
name: gama-linux-jdk
path: |
./gama-platform*amd64.zip
- name: Remove already moved builds
if: env.CONTINUE == 'true'
run: |
rm Gama1.7-macosx*zip
- uses: actions/upload-artifact@v2
if: env.CONTINUE == 'true'
with:
name: gama-windows
path: |
./Gama1.7-win32*zip
./icon256.ico
./windows_installer_script.iss
- uses: actions/upload-artifact@v2
if: env.CONTINUE == 'true'
with:
name: gama-zip-builds
path: |
./Gama*zip
outputs:
continue_pipeline: ${{ env.CONTINUE }}
#
# MacOS signature Pipelines
#
macOS-signing-x86_64:
needs: build
if: needs.build.outputs.continue_pipeline == 'true'
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- name: Signing zip
uses: ./.github/actions/macOS-sign
with:
toSignedZipName: Gama1.7-macosx.cocoa.x86_64
IS_WITH_JDK: false
# Pass secrets
MACOS_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE }}
MACOS_CERTIFICATE_PWD: ${{ secrets.MACOS_CERTIFICATE_PWD }}
MACOS_KEYCHAIN_PWD: ${{ secrets.MACOS_KEYCHAIN_PWD }}
MACOS_DEV_ID: ${{ secrets.MACOS_DEV_ID }}
NOTARY_APPLE_ID: ${{ secrets.NOTARY_APPLE_ID }}
NOTARY_PASSWORD: ${{ secrets.NOTARY_PASSWORD }}
NOTARY_TEAM_ID: ${{ secrets.NOTARY_TEAM_ID }}
macOS-signing-x86_64_withJDK:
needs: build
if: needs.build.outputs.continue_pipeline == 'true'
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- name: Signing zip
uses: ./.github/actions/macOS-sign
with:
toSignedZipName: Gama1.7-macosx.cocoa.x86_64_withJDK
IS_WITH_JDK: true
# Pass secrets
MACOS_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE }}
MACOS_CERTIFICATE_PWD: ${{ secrets.MACOS_CERTIFICATE_PWD }}
MACOS_KEYCHAIN_PWD: ${{ secrets.MACOS_KEYCHAIN_PWD }}
MACOS_DEV_ID: ${{ secrets.MACOS_DEV_ID }}
NOTARY_APPLE_ID: ${{ secrets.NOTARY_APPLE_ID }}
NOTARY_PASSWORD: ${{ secrets.NOTARY_PASSWORD }}
NOTARY_TEAM_ID: ${{ secrets.NOTARY_TEAM_ID }}
macOS-signing-aarch64:
needs: [macOS-signing-x86_64, macOS-signing-x86_64_withJDK]
if: needs.build.outputs.continue_pipeline == 'true'
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- name: Signing zip
uses: ./.github/actions/macOS-sign
with:
toSignedZipName: Gama1.7-macosx.cocoa.aarch64
IS_WITH_JDK: false
# Pass secrets
MACOS_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE }}
MACOS_CERTIFICATE_PWD: ${{ secrets.MACOS_CERTIFICATE_PWD }}
MACOS_KEYCHAIN_PWD: ${{ secrets.MACOS_KEYCHAIN_PWD }}
MACOS_DEV_ID: ${{ secrets.MACOS_DEV_ID }}
NOTARY_APPLE_ID: ${{ secrets.NOTARY_APPLE_ID }}
NOTARY_PASSWORD: ${{ secrets.NOTARY_PASSWORD }}
NOTARY_TEAM_ID: ${{ secrets.NOTARY_TEAM_ID }}
macOS-signing-aarch64_withJDK:
needs: [macOS-signing-x86_64, macOS-signing-x86_64_withJDK]
if: needs.build.outputs.continue_pipeline == 'true'
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- name: Signing zip
uses: ./.github/actions/macOS-sign
with:
toSignedZipName: Gama1.7-macosx.cocoa.aarch64_withJDK
IS_WITH_JDK: true
# Pass secrets
MACOS_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE }}
MACOS_CERTIFICATE_PWD: ${{ secrets.MACOS_CERTIFICATE_PWD }}
MACOS_KEYCHAIN_PWD: ${{ secrets.MACOS_KEYCHAIN_PWD }}
MACOS_DEV_ID: ${{ secrets.MACOS_DEV_ID }}
NOTARY_APPLE_ID: ${{ secrets.NOTARY_APPLE_ID }}
NOTARY_PASSWORD: ${{ secrets.NOTARY_PASSWORD }}
NOTARY_TEAM_ID: ${{ secrets.NOTARY_TEAM_ID }}
#
# Linux packaging Pipelines
#
debian-archive:
# https://earthly.dev/blog/creating-and-hosting-your-own-deb-packages-and-apt-repo/#step-1-creating-a-deb-package
needs: build
if: needs.build.outputs.continue_pipeline == 'true'
runs-on: ubuntu-latest
strategy:
matrix:
zipName: [gama-platform_1.8.2-1_amd64, gama-platform-jdk_1.8.2-1_amd64]
steps:
- name: Prepare vm
run: |
sudo apt-get install -y gcc dpkg-dev gpg
mkdir -p ${{ github.workspace }}/${{ matrix.zipName }}/DEBIAN ${{ github.workspace }}/${{ matrix.zipName }}/opt/gama-platform ${{ github.workspace }}/${{ matrix.zipName }}/usr/share/applications
- uses: actions/download-artifact@v2
with:
name: gama-linux-jdk
path: ${{ github.workspace }}/${{ matrix.zipName }}/opt/gama-platform
- name: Get extra files
run: |
wget https://raw.githubusercontent.com/gama-platform/gama/${GITHUB_REF##*/}/ummisco.gama.product/extraresources/installer/unix/DEBIAN/control -O ${{ github.workspace }}/${{ matrix.zipName }}/DEBIAN/control
wget https://raw.githubusercontent.com/gama-platform/gama/${GITHUB_REF##*/}/ummisco.gama.product/extraresources/installer/unix/gama-platform.desktop -O ${{ github.workspace }}/${{ matrix.zipName }}/usr/share/applications/gama-platform.desktop
cd ${{ github.workspace }}/${{ matrix.zipName }}/opt/gama-platform && unzip ${{ matrix.zipName }}.zip && cd -
rm ${{ github.workspace }}/${{ matrix.zipName }}/opt/gama-platform/*.zip
- name: Build DEB archive
run: |
dpkg --build ${{ github.workspace }}/${{ matrix.zipName }}
dpkg --info ${{ github.workspace }}/${{ matrix.zipName }}.deb
- uses: actions/upload-artifact@v3
with:
name: gama-linux-deb
path: |
${{ github.workspace }}/${{ matrix.zipName }}.deb
#
# Windows packaging Pipelines
#
windows-msi:
needs: build
if: needs.build.outputs.continue_pipeline == 'true'
runs-on: windows-latest
strategy:
matrix:
zipName: [Gama1.7-win32.win32.x86_64.zip, Gama1.7-win32.win32.x86_64_withJDK.zip]
steps:
- uses: actions/download-artifact@v2
with:
name: gama-windows
- name: Change variables for JDK installer
if: contains( matrix.zipName, 'withJDK')
run: |
get-content windows_installer_script.iss | %{$_ -replace "x86_64","x86_64_withJDK"}
- name: Prepare vm
run: |
mkdir gama_output
- name: Create installer
run: iscc.exe windows_installer_script.iss
- uses: actions/upload-artifact@v3
with:
name: gama-windows-exe
path: |
gama_output
#
# Github releasing
#
publish-archives:
needs: [macOS-signing-aarch64, macOS-signing-aarch64_withJDK, debian-archive, windows-msi]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
# Get zip archives
- uses: actions/download-artifact@v2
with:
name: gama-zip-builds
# Get Mac dmg signed archives
- uses: actions/download-artifact@v2
with:
name: gama-mac-signed
# Get Linux deb archive
- uses: actions/download-artifact@v2
with:
name: gama-linux-deb
# Get Linux deb archive
- uses: actions/download-artifact@v2
with:
name: gama-windows-exe
- name: Set Travis env
run: |
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
echo "[WARNING] Forcing travis version release"
echo "TRAVIS_MSG=ci release" >> $GITHUB_ENV
else
echo "TRAVIS_MSG=$(echo $github.event.head_commit.message )" >> $GITHUB_ENV
fi
echo $TRAVIS_MSG
- name: Get travis scripts ready to use
run: |
# Get full travis script folder
chmod +x ./travis/*
# Debug
ls -lah ${{ github.workspace }}
- name: Publish to Github
run: ./travis/publish.sh
env:
SSH_USER_PWD: ${{ secrets.USER_PWD }}
SSH_HOST: ${{ secrets.SSH_HOST }}
MSG: ${{ env.TRAVIS_MSG }}
GITHUB_TOKEN: ${{ github.token }}
SSHPASS: ${{ secrets.USER_PWD }}
BOT_TOKEN: ${{ secrets.BOT_TOKEN }}
TRAVIS_COMMIT: ${ GITHUB_SHA }
TRAVIS_EVENT_TYPE: ${{ github.event_name }}
thePATH: "${{ github.workspace }}/Gama1.7"