-
Notifications
You must be signed in to change notification settings - Fork 12
258 lines (226 loc) · 9.05 KB
/
deploy.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
name: Deploy
on:
push:
tags:
- "v*.*.*"
concurrency:
group: "${{ github.workflow }}"
cancel-in-progress: true
env:
BUILD_TYPE: Release
jobs:
prepare:
runs-on: ubuntu-latest
outputs:
version: "${{ steps.setversion.outputs.version }}"
steps:
- name: Checkout VERSION
uses: actions/checkout@v4
with:
ref: main
sparse-checkout: VERSION
sparse-checkout-cone-mode: false
- name: Set environmental variables
run: |
echo "RELEASE_VERSION=$(cat "${{ github.workspace }}/VERSION")" >> "$GITHUB_ENV"
echo "TAG_VERSION=$(echo "${{ github.ref_name }}" | cut -d'v' -f2)" >> "$GITHUB_ENV"
echo "MAIN_SHA=$(git rev-parse --verify main)" >> "$GITHUB_ENV"
- name: Check release version and commit sha
run: |
if [[ "$RELEASE_VERSION" != "$TAG_VERSION" ]]; then
echo "Tag version ($TAG_VERSION) does not match release version ($RELEASE_VERSION)"
exit 1
elif [[ "$GITHUB_SHA" != "$MAIN_SHA" ]]; then
echo "Tag commit ($GITHUB_SHA) does not match latest commit on main ($MAIN_SHA)"
exit 1
fi
- name: Set application version
id: setversion
run: echo "version=$RELEASE_VERSION" >> "$GITHUB_OUTPUT"
build-appimage:
needs:
- prepare
runs-on: ubuntu-latest
env:
APP_VER: "${{ needs.prepare.outputs.version }}"
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ github.ref_name }}
submodules: true
- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
aqtversion: ==3.1.*
version: 6.8.0
host: linux
target: desktop
arch: linux_gcc_64
modules: >-
qtimageformats
qtmultimedia
qtnetworkauth
qtwaylandcompositor
- name: Install tools
run: |
sudo apt update -y && sudo apt install wget fuse libxcb-cursor0 appstream appstream-util ninja-build -y
wget https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage
wget https://github.com/AppImage/AppImageKit/releases/download/13/appimagetool-x86_64.AppImage
chmod +x linuxdeployqt-continuous-x86_64.AppImage
chmod +x appimagetool-x86_64.AppImage
- name: Prepare AppDir
run: >-
mkdir -p QuranCompanion.AppDir/usr/{bin,share/{applications,metainfo,icons/hicolor/256x256/apps}}
cp
${{github.workspace}}/dist/xdg/io.github._0xzer0x.qurancompanion.desktop
QuranCompanion.AppDir/
cp ${{github.workspace}}/dist/xdg/logo256.png
QuranCompanion.AppDir/io.github._0xzer0x.qurancompanion.png
cp
${{github.workspace}}/dist/xdg/io.github._0xzer0x.qurancompanion.desktop
QuranCompanion.AppDir/usr/share/applications/
cp ${{github.workspace}}/dist/xdg/logo256.png
QuranCompanion.AppDir/usr/share/icons/hicolor/256x256/apps/io.github._0xzer0x.qurancompanion.png
cp ${{github.workspace}}/dist/xdg/io.github._0xzer0x.qurancompanion.metainfo.xml
QuranCompanion.AppDir/usr/share/metainfo/io.github._0xzer0x.qurancompanion.appdata.xml
echo -e "[Paths]\nPlugins = ../plugins\nLibraries = ../lib\nImports =
../qml\nQml2Imports = ../qml" > QuranCompanion.AppDir/usr/bin/qt.conf
- name: Configure
run: >-
cmake -B ${{github.workspace}}/build
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
- name: Build
run: "cmake --build ${{github.workspace}}/build"
- name: Install
run: >-
cmake --install ${{github.workspace}}/build --prefix
QuranCompanion.AppDir/usr
- name: Run linuxdeployqt
run: >-
rm
${QT_PLUGIN_PATH}/sqldrivers/libqsqlmimer.so
${QT_PLUGIN_PATH}/sqldrivers/libqsqlmysql.so
${QT_PLUGIN_PATH}/sqldrivers/libqsqlodbc.so
${QT_PLUGIN_PATH}/sqldrivers/libqsqlpsql.so
${{github.workspace}}/linuxdeployqt-continuous-x86_64.AppImage
QuranCompanion.AppDir/usr/bin/quran-companion
-unsupported-allow-new-glibc -qmake=$(which qmake) -no-translations
-extra-plugins=sqldrivers,iconengines,imageformats,multimedia,networkinformation,platforms,platformthemes,wayland-decoration-client,wayland-graphics-integration-client,wayland-graphics-integration-server,wayland-shell-integration,xcbglintegrations,egldeviceintegrations
-verbose=1
- name: Make AppImage
run: >-
${{github.workspace}}/appimagetool-x86_64.AppImage -n QuranCompanion.AppDir
Quran_Companion-${{env.APP_VER}}-x86_64.AppImage
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: appimage
path: "Quran_Companion-${{env.APP_VER}}-x86_64.AppImage"
retention-days: 7
build-dmg:
needs:
- prepare
runs-on: macos-12
env:
APP_VER: "${{ needs.prepare.outputs.version }}"
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ github.ref_name }}
submodules: true
- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
aqtversion: ==3.1.*
version: 6.8.0
host: "mac"
cache: true
target: "desktop"
arch: "clang_64"
modules: >-
qtimageformats
qtmultimedia
qtnetworkauth
- name: Install tools
run: |
brew install graphicsmagick imagemagick
npm install --global create-dmg
- name: Configure
run: >-
cmake -B ${{github.workspace}}/build
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
- name: Make DMG
run: |
[[ -f "${QT_PLUGIN_PATH}/sqldrivers/libqsqlodbc.dylib" ]] && rm -rf ${QT_PLUGIN_PATH}/sqldrivers/libqsqlodbc.dylib
[[ -f "${QT_PLUGIN_PATH}/sqldrivers/libqsqlpsql.dylib" ]] && rm -rf ${QT_PLUGIN_PATH}/sqldrivers/libqsqlpsql.dylib
[[ -f "${QT_PLUGIN_PATH}/sqldrivers/libqsqlmimer.dylib" ]] && rm -rf ${QT_PLUGIN_PATH}/sqldrivers/libqsqlmimer.dylib
[[ -d "${QT_PLUGIN_PATH}/sqldrivers/libqsqlodbc.dylib.dSYM" ]] && rm -rf ${QT_PLUGIN_PATH}/sqldrivers/libqsqlodbc.dylib.dSYM
[[ -d "${QT_PLUGIN_PATH}/sqldrivers/libqsqlpsql.dylib.dSYM" ]] && rm -rf ${QT_PLUGIN_PATH}/sqldrivers/libqsqlpsql.dylib.dSYM
[[ -d "${QT_PLUGIN_PATH}/sqldrivers/libqsqlmimer.dylib.dSYM" ]] && rm -rf ${QT_PLUGIN_PATH}/sqldrivers/libqsqlmimer.dylib.dSYM
cd "${{github.workspace}}/build"
macdeployqt quran-companion.app
create-dmg --dmg-title="Install Quran Companion" quran-companion.app || true
file="$(find . -maxdepth 1 -name "Quran Companion*.dmg" | head -n 1)"
if [[ -n "$file" ]]; then
mv "$file" "${{ github.workspace }}/Quran_Companion-${{env.APP_VER}}-x86_64.dmg"
else
echo "DMG file not found!"
exit 1
fi
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: dmg
path: "Quran_Companion-${{env.APP_VER}}-x86_64.dmg"
retention-days: 7
deploy:
needs:
- prepare
- build-appimage
- build-dmg
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
attestations: write
env:
APP_VER: "${{ needs.prepare.outputs.version }}"
steps:
- name: Checkout CHANGELOG.md
uses: actions/checkout@v4
with:
ref: ${{ github.ref_name }}
sparse-checkout-cone-mode: false
sparse-checkout: CHANGELOG.md
- name: Download artifacts
uses: actions/download-artifact@v4
with:
merge-multiple: true
- name: Verify artifacts
run: |
if [[ ! -f "Quran_Companion-${{env.APP_VER}}-x86_64.AppImage" || ! -f "Quran_Companion-${{env.APP_VER}}-x86_64.dmg" ]]; then
echo "Artifacts missing" >&2
echo -e "ls -la:\n$(ls -la)" >&2
exit 1
fi
- name: Generate attestations
uses: actions/attest-build-provenance@v1
with:
subject-path: |
Quran_Companion-${{env.APP_VER}}-x86_64.AppImage
Quran_Companion-${{env.APP_VER}}-x86_64.dmg
- name: Generate checksums
run: |
b2sum "Quran_Companion-${{env.APP_VER}}-x86_64.AppImage" > "Quran_Companion-${{env.APP_VER}}-x86_64.AppImage.b2sum"
b2sum "Quran_Companion-${{env.APP_VER}}-x86_64.dmg" > "Quran_Companion-${{env.APP_VER}}-x86_64.dmg.b2sum"
- name: Release
uses: ncipollo/[email protected]
with:
name: "${{ github.ref_name }}"
tag: "${{ github.ref_name }}"
bodyFile: CHANGELOG.md
artifacts: "Quran_Companion-${{env.APP_VER}}-x86_64.*"