-
Notifications
You must be signed in to change notification settings - Fork 87
260 lines (254 loc) · 9.64 KB
/
build.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
name: build
on:
push:
branches:
- master
- develop
- release/*
- feat/*
- hotfix/*
tags:
- v2.*
env:
QT_VERSION_MAJOR: 5
QT_VERSION_MINOR: 14
QT_VERSION_PATCH: 2
QT_VERSION: 5.14.2
jobs:
build_linux:
name: Linux
runs-on: ubuntu-18.04
env:
QT_INSTALL_TARGET_ARCH: gcc_64
QT_INSTALL_TARGET_DIR_PREFIX: /opt
steps:
- uses: actions/checkout@v1
- uses: actions/setup-python@v1
with:
python-version: '3.8'
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y -qq --no-install-recommends git make cmake g++ wget curl
sudo apt-get install -y -qq --no-install-recommends xvfb libgl-dev fcitx fcitx-frontend-qt5 libxcb-xinerama0
- name: Cache Qt
id: cache-qt
uses: actions/cache@v1
with:
path: ${{ env.QT_INSTALL_TARGET_DIR_PREFIX }}/Qt
key: QtCache-Linux-${{ env.QT_VERSION }}
- name: Install Qt
uses: jurplel/install-qt-action@v2
with:
cached: ${{ steps.cache-qt.outputs.cache-hit }}
version: ${{ env.QT_VERSION }}
host: linux
target: desktop
arch: ${{ env.QT_INSTALL_TARGET_ARCH }}
dir: ${{ env.QT_INSTALL_TARGET_DIR_PREFIX }}
modules: qtwebengine
- name: Download deploy tool
run: |
sudo wget -q -O /usr/bin/linuxdeployqt https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage
sudo chmod a+x /usr/bin/linuxdeployqt
- name: Install and config conan
run: |
pip install conan==1.*
conan remote add wiznoteplus https://altairwei.jfrog.io/artifactory/api/conan/wiznoteplus-conan
conan remote add bincrafters https://bincrafters.jfrog.io/artifactory/api/conan/public-conan
conan config set general.revisions_enabled=1
conan profile new default --detect
conan profile update settings.compiler.libcxx=libstdc++11 default
- name: Build project
env:
QT_INSTALL_PREFIX: ${{ env.QT_INSTALL_TARGET_DIR_PREFIX }}/Qt/${{ env.QT_VERSION }}/${{ env.QT_INSTALL_TARGET_ARCH }}
run: |
mkdir -p _build
./.ci/build.sh $(pwd) $(pwd)/_build
- uses: actions/upload-artifact@v1
with:
name: Linux_Dist
path: _build/package/dist
- name: Upload to webdav
run: |
find _build/package/dist -type f -name "WizNotePlus-*" | while read x; do
filename=$(basename $x)
echo "Uploading $filename"
curl --basic --user "${{ secrets.WEBDAV }}" -T $x "https://dav.jianguoyun.com/dav/WizNotePlus/testing/$filename";
done
build_windows:
name: Windows
runs-on: windows-2019
env:
QT_INSTALL_TARGET_ARCH: msvc2017_64
QT_INSTALL_TARGET_DIR_PREFIX: ${{ github.workspace }}
steps:
- uses: actions/checkout@v1
- uses: actions/setup-python@v1
with:
python-version: '3.8'
- name: Install dependencies
shell: powershell
run: |
choco install -y wget curl
- name: Install and config conan
shell: powershell
run: |
python -m pip install conan==1.*
conan remote add wiznoteplus https://altairwei.jfrog.io/artifactory/api/conan/wiznoteplus-conan
conan remote add bincrafters https://bincrafters.jfrog.io/artifactory/api/conan/public-conan
conan config set general.revisions_enabled=1
conan profile new default --detect
- name: Cache Qt
id: cache-qt
uses: actions/cache@v1
with:
path: ${{ env.QT_INSTALL_TARGET_DIR_PREFIX }}\Qt
key: QtCache-Windows-${{ env.QT_VERSION }}
- name: Install Qt
uses: jurplel/install-qt-action@v2
with:
cached: ${{ steps.cache-qt.outputs.cache-hit }}
version: ${{ env.QT_VERSION }}
host: windows
target: desktop
arch: win64_${{ env.QT_INSTALL_TARGET_ARCH }}
dir: ${{ env.QT_INSTALL_TARGET_DIR_PREFIX }}
modules: qtwebengine
- name: Build project
env:
QT_INSTALL_PREFIX: ${{ env.QT_INSTALL_TARGET_DIR_PREFIX }}\Qt\${{ env.QT_VERSION }}\${{ env.QT_INSTALL_TARGET_ARCH }}
shell: powershell
run: |
mkdir -Force _build
.\.ci\build.ps1 "$PWD" "$PWD\_build" "github actions"
- uses: actions/upload-artifact@v1
with:
name: Windows_Dist
path: _build/package/dist
- name: Upload to webdav
shell: powershell
run: |
Remove-Item alias:curl
$artifacts = Get-ChildItem -Path _build/package/dist -Include WizNotePlus-* -File -Recurse
foreach ($x in $artifacts){
$filename = Split-Path $x -leaf
Write-Host "Uploading $filename"
curl --basic --user "${{ secrets.WEBDAV }}" -T $x "https://dav.jianguoyun.com/dav/WizNotePlus/testing/$filename";
}
build_macos:
name: MacOS
runs-on: macos-10.15
env:
QT_INSTALL_TARGET_ARCH: clang_64
QT_INSTALL_TARGET_DIR_PREFIX: /Applications
steps:
- uses: actions/checkout@v1
- uses: actions/setup-python@v1
with:
python-version: '3.8'
- uses: actions/setup-node@v1
with:
node-version: '10.x'
- name: Install dependencies
run: |
sudo chown -R $(whoami) $(npm config get prefix)/{lib/node_modules,bin,share}
npm install --global appdmg
brew install curl
- name: Install and config conan
run: |
python -m pip install conan==1.*
conan remote add wiznoteplus https://altairwei.jfrog.io/artifactory/api/conan/wiznoteplus-conan
conan remote add bincrafters https://bincrafters.jfrog.io/artifactory/api/conan/public-conan
conan config set general.revisions_enabled=1
conan profile new default --detect
- name: Cache Qt
id: cache-qt
uses: actions/cache@v1
with:
path: ${{ env.QT_INSTALL_TARGET_DIR_PREFIX }}/Qt
key: QtCache-MacOS-${{ env.QT_VERSION }}
- name: Install Qt
uses: jurplel/install-qt-action@v2
with:
cached: ${{ steps.cache-qt.outputs.cache-hit }}
version: ${{ env.QT_VERSION }}
host: mac
target: desktop
arch: ${{ env.QT_INSTALL_TARGET_ARCH }}
dir: ${{ env.QT_INSTALL_TARGET_DIR_PREFIX }}
modules: qtwebengine
- name: Build project
env:
QT_INSTALL_PREFIX: ${{ env.QT_INSTALL_TARGET_DIR_PREFIX }}/Qt/${{ env.QT_VERSION }}/${{ env.QT_INSTALL_TARGET_ARCH }}
run: |
mkdir -p _build
./.ci/build.sh $(pwd) $(pwd)/_build
- uses: actions/upload-artifact@v1
with:
name: MacOS_Dist
path: _build/package/dist
- name: Upload to webdav
run: |
find _build/package/dist -type f -name "WizNotePlus-*" | while read x; do
filename=$(basename $x)
echo "Uploading $filename"
curl --basic --user "${{ secrets.WEBDAV }}" -T $x "https://dav.jianguoyun.com/dav/WizNotePlus/testing/$filename";
done
release:
needs: [build_linux, build_windows, build_macos]
runs-on: ubuntu-latest
if: contains(github.ref, 'refs/tags/v')
steps:
- uses: actions/checkout@v1
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y -qq --no-install-recommends curl
- name: Download pre-built packages for Linux
uses: actions/download-artifact@v1
with:
name: Linux_Dist
path: artifacts
- name: Download pre-built packages for Windows
uses: actions/download-artifact@v1
with:
name: Windows_Dist
path: artifacts
- name: Download pre-built packages for MacOS
uses: actions/download-artifact@v1
with:
name: MacOS_Dist
path: artifacts
- name: Create Release Notes
id: release_notes
run: |
version=$(printf '${{ github.ref }}' | sed -E 's#refs/tags/v(.*)#\1#')
notes_zh="dist/changes-${version}-zh-CN.md"
[[ -f "${notes_zh}" ]] || { echo >&2 "release notes is required."; exit 1; }
notes_en="dist/changes-${version}-en-US.md"
[[ -f "${notes_en}" ]] || { echo >&2 "release notes is required."; exit 1; }
content=$(cat ${notes_zh})
content="${content}\n\n---\n\n$(cat ${notes_en})"
printf "${content}\n" > dist/changes-${version}.md
echo "::set-output name=version::${version}"
echo "::set-output name=content_file::dist/changes-${version}.md"
- name: Create Release
id: create_release
uses: ncipollo/release-action@v1
with:
name: WizNotePlus v${{ steps.release_notes.outputs.version }}
token: ${{ secrets.GITHUB_TOKEN }}
artifacts: "artifacts/*"
bodyFile: ${{ steps.release_notes.outputs.content_file }}
draft: true
prerelease: true
- name: Upload to webdav
run: |
version=$(printf '${{ github.ref }}' | sed -E 's#refs/tags/v(.*)#\1#')
curl --basic --user "${{ secrets.WEBDAV }}" -X MKCOL "https://dav.jianguoyun.com/dav/WizNotePlus/stable/v$version"
find artifacts -type f -name "WizNotePlus-*" | while read x; do
filename=$(basename $x)
echo "Uploading $filename"
curl --basic --user "${{ secrets.WEBDAV }}" -T $x "https://dav.jianguoyun.com/dav/WizNotePlus/stable/v$version/$filename";
done