forked from pbek/QOwnNotes
-
Notifications
You must be signed in to change notification settings - Fork 0
272 lines (259 loc) · 9.9 KB
/
build-release-next.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
name: 📣 Build release of QOwnNotes (Next)
on:
workflow_dispatch:
# push:
# branches:
# - main
# tags-ignore:
# - '*'
# # https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#example-including-paths
# paths:
## - 'src/**'
## - 'tests/**'
# - '.github/workflows/build-release-next.yml'
# For testing also on pull requests
# pull_request:
# paths:
# - 'src/**'
defaults:
run:
working-directory: src
#--------------------------------------------------------------------------------
# Define application name & version
#--------------------------------------------------------------------------------
env:
EXECUTABLE: "QOwnNotes"
APPLICATION: "QOwnNotes"
UNIXNAME: "QOwnNotes"
QMAKE_PROJECT: "QOwnNotes.pro"
PUBLISHER: "Patrizio Bekerle"
REPO_DIR: "/home/runner/work/QOwnNotes"
QT_MODULES: ""
QMAKE: qmake
CORES: 16
jobs:
create_release:
name: '🗃️️ Prepare release'
permissions:
contents: write # for actions/create-release to create a release
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
release_id: ${{ steps.create_release.outputs.id }}
steps:
- uses: actions/checkout@v4
- name: Set Env
run: |
export VERSION=$(cat version.h | sed 's/[^0-9,.]//g')
#export TAG=v${VERSION}.${GITHUB_RUN_ID}.${GITHUB_RUN_NUMBER}
export TAG=v${VERSION}
export RELEASE_TEXT=$(grep -Pzo "## ${VERSION}\n(\n|.)+?\n##" ../CHANGELOG.md | sed '$ d')
echo "VERSION=${VERSION}" >> $GITHUB_ENV
echo "TAG=${TAG}" >> $GITHUB_ENV
# add multiline release text
echo "RELEASE_TEXT<<EOF" >> $GITHUB_ENV
echo "${RELEASE_TEXT}" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- name: Printenv
run: |
echo "VERSION=${VERSION}"
echo "TAG=${TAG}"
echo "RELEASE_TEXT=${RELEASE_TEXT}"
printenv
# - name: Create release
# id: create_release
# uses: actions/create-release@v1
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# tag_name: ${{ env.TAG }}
# release_name: Release v${{ env.VERSION }}
# body: ${{ env.RELEASE_TEXT }}
# draft: true
# prerelease: false
#--------------------------------------------------------------------------------
# Workflow jobs (GNU/Linux, macOS & Windows)
#--------------------------------------------------------------------------------
#
# AppImage build
#
build-appimage:
needs: create_release
runs-on: ubuntu-20.04
env:
QT_VERSION: 5.15.2
BUILD_DIR: build
name: '🐧 AppImage Qt 5.15.2'
steps:
- name: '🧰 Checkout'
uses: actions/checkout@v4
with:
submodules: recursive
- name: '⚙️ Cache Qt'
id: cache-qt
uses: actions/cache@v3
with:
path: ../Qt
key: ${{runner.os}}-qtcachedir-${{env.QT_VERSION}}
- name: '⚙️ Install Qt'
uses: jurplel/install-qt-action@v3
with:
version: ${{env.QT_VERSION}}
modules: ${{env.QT_MODULES}}
aqtversion: '==2.0.0'
setup-python: false
cache: ${{steps.cache-qt.outputs.cache-hit}}
- name: '⚙️ Install dependencies'
run: |
sudo apt-get update
sudo apt install desktop-file-utils libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-render-util0 libxcb-xinerama0 libxcb-composite0 libxcb-cursor0 libxcb-damage0 libxcb-dpms0 libxcb-dri2-0 libxcb-dri3-0 libxcb-ewmh2 libxcb-glx0 libxcb-present0 libxcb-randr0 libxcb-record0 libxcb-render0 libxcb-res0 libxcb-screensaver0 libxcb-shape0 libxcb-shm0 libxcb-sync1 libxcb-util1 libxkbcommon-x11-0
- name: '🚧 Compile application'
run: |
echo "#define RELEASE \"AppImage\"" > release.h
${{env.QMAKE}} ${{env.QMAKE_PROJECT}} CONFIG+=release PREFIX=/usr
lrelease QOwnNotes.pro
make -j${{env.CORES}}
- name: '⚙️ Install linuxdeploy'
run: |
wget https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage
wget https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-x86_64.AppImage
chmod +x linuxdeploy-x86_64.AppImage
chmod +x linuxdeploy-plugin-qt-x86_64.AppImage
- name: '📦 Create AppImage'
run: |
export QMAKE=${{env.REPO_DIR}}/Qt/${{env.QT_VERSION}}/gcc_64/bin/${{env.QMAKE}}
export PATH=${{env.REPO_DIR}}/Qt/${{env.QT_VERSION}}/gcc_64/libexec:$PATH
export EXTRA_QT_PLUGINS="svg;"
cp ../icons/icon.png QOwnNotes.png
./linuxdeploy-x86_64.AppImage -v0 --appdir ${{env.BUILD_DIR}} -e ${{env.UNIXNAME}} -i ${{env.UNIXNAME}}.png -d PBE.QOwnNotes.desktop --plugin qt
# mkdir -p ${{env.BUILD_DIR}}/usr/plugins/iconengines && cp -r ${{env.REPO_DIR}}/Qt/${{env.QT_VERSION}}/gcc_64/plugins/iconengines/libqsvgicon.so ${{env.BUILD_DIR}}/usr/plugins/iconengines
# mkdir -p ${{env.BUILD_DIR}}/usr/languages && cp -r languages/*.qm ${{env.BUILD_DIR}}/usr/languages
find ${{env.BUILD_DIR}}
./linuxdeploy-x86_64.AppImage --appdir ${{env.BUILD_DIR}} --output appimage
rm linuxdeploy-x86_64.AppImage
rm linuxdeploy-plugin-qt-x86_64.AppImage
ls -hal *.AppImage
find -iname "*.AppImage"
mv *.AppImage ${{env.EXECUTABLE}}-x86_64.AppImage || true
sha256sum ${{env.EXECUTABLE}}-x86_64.AppImage > ${{env.EXECUTABLE}}-x86_64.AppImage.sha256sum
ls -hal *.AppImage
find -iname "*.AppImage"
pwd
- name: '📤 Upload artifact: AppImage'
uses: actions/upload-artifact@v4
with:
name: ${{env.EXECUTABLE}}-x86_64.AppImage
path: src/${{env.EXECUTABLE}}-x86_64.AppImage
- name: '📤 Upload artifact: AppImage sha256sum'
uses: actions/upload-artifact@v4
with:
name: ${{env.EXECUTABLE}}-x86_64.AppImage.sha256sum
path: src/${{env.EXECUTABLE}}-x86_64.AppImage.sha256sum
# #
# # Snap build
# #
# build-snap:
# needs: create_release
# runs-on: ubuntu-latest
## container:
## image: ghcr.io/pbek/qownnotes-ubuntu18-dev:latest
## options: --user root
# env:
# QT_VERSION: 5.15.2
# name: '🐧 Snap Qt 5.15.2'
# steps:
#
# - name: '🧰 Checkout'
# uses: actions/checkout@v4
# with:
# submodules: recursive
#
# - name: '⚙️ Set Env'
# shell: bash
# run: |
# export VERSION=$(cat version.h | sed 's/[^0-9,.]//g')
# echo "VERSION=${VERSION}" >> $GITHUB_ENV
#
## - name: '⚙️ Install Snapcraft'
## uses: samuelmeuli/action-snapcraft@v2
## env:
## SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAP_TOKEN_GH }}
## with:
## use_lxd: ${{ matrix.os == 'ubuntu-18.04' }}
### snapcraft_token: ${{ secrets.SNAP_TOKEN_GH }}
# - name: '⚙️ Cache Qt'
# id: cache-qt
# uses: actions/cache@v3
# with:
# path: ../Qt
# key: ${{runner.os}}-qtcachedir-${{env.QT_VERSION}}
# - name: '⚙️ Install Qt'
# uses: jurplel/install-qt-action@v3
# with:
# version: ${{env.QT_VERSION}}
# modules: ${{env.QT_MODULES}}
## setup-python: false
# cache: ${{steps.cache-qt.outputs.cache-hit}}
# - name: '⚙️ Printenv'
# shell: bash
# run: |
# echo "VERSION=${VERSION}"
# printenv
#
# - name: '🚧 Compile application'
# uses: snapcore/action-build@v1
# id: snapcraft
#
## - name: '🚧 Compile application'
## run: |
## cd ..
## lxd version
## sudo usermod -a -G lxd ${USER}
## newgrp lxd
## sudo adduser --system --no-create-home --group lxduser # create system user
## echo "$USER ALL=(ALL) NOPASSWD:ALL" | sudo tee -a /etc/sudoers # allow sudo without password
## echo "lxduser ALL=(ALL) NOPASSWD:ALL" | sudo tee -a /etc/sudoers # allow sudo without password
## ls -al /var/snap/lxd/common/lxd/unix.socket
## sudo systemctl restart snap.lxd.daemon
## cat /var/snap/lxd/common/config
## ls -al /var/snap/lxd/common/lxd/unix.socket
## sudo -u lxduser -g lxd snapcraft --use-lxd
## ls
### run: cd .. && sg lxd -c 'snapcraft --use-lxd' && ls
#
# # - name: Release Snap for Linux
# # uses: actions/upload-release-asset@v1
# # env:
# # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# # with:
# # upload_url: ${{ needs.create_release.outputs.upload_url }}
# # asset_path: ./qownnotes_${{ env.VERSION }}_amd64.snap
# # asset_name: QOwnNotes-amd64.snap
# # asset_content_type: application/octet-stream
#
# # - shell: bash
# # run: |
# # snapcraft --version
# # cd .. && pwd
# # - name: Deploy Snap
# # uses: snapcore/action-publish@v1
# # continue-on-error: true
# # env:
# # # `snapcraft export-login --snaps=qownnotes --acls package_access,package_push,package_update,package_release -`, token valid for one year
# # SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAP_TOKEN_GH }}
# # with:
# # snap: /home/runner/work/QOwnNotes/QOwnNotes/qownnotes_${{ env.VERSION }}_amd64.snap
# # release: stable
#
# - name: '📤 Upload artifact: Snap'
# uses: actions/upload-artifact@v4
# with:
# name: qownnotes_${{ env.VERSION }}_amd64.snap
# path: /home/runner/work/QOwnNotes/QOwnNotes/qownnotes_${{ env.VERSION }}_amd64.snap
#
# - name: '📤 Upload artifact: Snap logs'
# uses: actions/upload-artifact@v4
# with:
# name: snapcraft-logs
# path: /home/runner/.cache/snapcraft/log/snapcraft-*.log
#