-
-
Notifications
You must be signed in to change notification settings - Fork 259
195 lines (194 loc) · 8.1 KB
/
build-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
name: build-release
on:
push:
tags:
- 'v*'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
QT_VERSION: 6.8.*
QT_MODULES: 'qtcharts qtserialbus qtserialport qtwebsockets'
jobs:
update-release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Delete Release
run: |
gh release delete ${{ github.ref_name }} -y || true
- name: Create Release
run: |
gh release create ${{ github.ref_name }} --title "Release ${{ github.ref_name }}" --notes "The version is ready. You can see the changed log: https://github.com/x-tools-author/x-tools/blob/master/Resources/Files/History.txt"
release-for-windows:
runs-on: windows-2022
needs: update-release
steps:
- name: Checkout
uses: actions/checkout@v4
with:
# 切换至最新的tag,格式为v开头的版本号
ref: ${{ github.ref }}
- name: Install Qt
uses: jurplel/install-qt-action@v4
with:
version: ${{ env.QT_VERSION }}
target: 'desktop'
arch: 'win64_msvc2022_64'
dir: ${{ github.workspace }}
modules: 'qtcharts qtserialbus qtserialport qtwebsockets'
- name: Build for Windows
shell: cmd
run: |
git fetch --tags
mkdir build
cd build
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64
cmake -DWITH_TOOLS:BOOL=OFF -DBUILD_SHARED_LIBS:BOOL=OFF -DCMAKE_PREFIX_PATH='${{ github.workspace }}/Qt/${{ env.QT_VERSION }}/win64_msvc2022_64' -DCMAKE_BUILD_TYPE=Release -G "NMake Makefiles" ../
cmake --build . --target xTools
dir && dir .\assets && dir .\assets\xTools
- name: Upload Release Asset for Windnows
run: |
cmake -E rename 'build\assets\xtools-windows-amd64.zip' 'build\assets\xtools-${{ github.ref_name }}-windows-amd64.zip'
dir && gh release upload ${{ github.ref_name }} 'build\assets\xtools-${{ github.ref_name }}-windows-amd64.zip'
release-for-linux:
runs-on: ubuntu-20.04
needs: update-release
steps:
- name: Checkout
uses: actions/checkout@v4
with:
# 切换至最新的tag,格式为v开头的版本号
ref: ${{ github.ref }}
- name: Install Qt
uses: jurplel/install-qt-action@v4
with:
aqtversion: '==3.1.*'
version: ${{ env.QT_VERSION }}
target: 'desktop'
arch: 'linux_gcc_64'
dir: ${{ github.workspace }}
modules: 'qtcharts qtserialbus qtserialport qtwebsockets'
- name: install-dependencies
run: |
sudo apt-get install -y libxcb-xinerama0 libxcb-cursor-dev
- name: Build for Linux
run: |
git fetch --tags
mkdir build
cd build
cmake ../ -DCMAKE_PREFIX_PATH='${{ github.workspace }}/Qt/${{ env.QT_VERSION }}/linux_gcc_64' -DCMAKE_BUILD_TYPE:STRING=Release -DX_TOOLS_LINUX_MAKE_APP_IMAGE_XTOOLS:BOOL=TRUE -G "Unix Makefiles"
cmake --build . --target xTools
dir && dir ./assets && dir ./assets/xTools
- name: Upload Release Asset for Linux
run: |
cmake -E rename build/xtools-linux-x86_64.AppImage build/xtools-${{ github.ref_name }}-linux-x86_64.AppImage
dir && gh release upload ${{ github.ref_name }} 'build/xtools-${{ github.ref_name }}-linux-x86_64.AppImage'
release-for-macos:
runs-on: macos-13
needs: update-release
steps:
- name: Checkout
uses: actions/checkout@v4
with:
# 切换至最新的tag,格式为v开头的版本号
ref: ${{ github.ref }}
- name: Install Qt for macOS
uses: jurplel/install-qt-action@v4
with:
version: '${{ env.QT_VERSION }}'
target: 'desktop'
arch: 'clang_64'
dir: ${{ github.workspace }}
modules: 'qtcharts qtserialbus qtserialport qtwebsockets'
- name: Build for macOS
# 278ERROR: no file at "/usr/local/opt/libiodbc/lib/libiodbc.2.dylib"
# brew unlink unixodbc
# brew install libiodbc
# ERROR: no file at "/Applications/Postgres.app/Contents/Versions/14/lib/libpq.5.dylib"
# ln -s /usr/local/Cellar/postgresql@14/14.10/lib/postgresql@14/libpq.5.14.dylib /Applications/Postgres.app/Contents/Versions/14/lib/libpq.5.dylib
run: |
git fetch --tags
# brew unlink unixodbc
# brew install libiodbc
mkdir -p /Applications/Postgres.app/Contents/Versions/14/lib
ln -s /usr/local/Cellar/postgresql@14/14.10/lib/postgresql@14/libpq.5.14.dylib /Applications/Postgres.app/Contents/Versions/14/lib/libpq.5.dylib
mkdir build
cd build
cmake ../ -DCMAKE_PREFIX_PATH='${{ github.workspace }}/Qt/${{ env.QT_VERSION }}/clang_64/lib/cmake/Qt6' -DCMAKE_BUILD_TYPE:STRING=Release -G "Unix Makefiles"
cmake --build . --target xTools
ls && ls ./assets && ls ./assets/xTools
- name: Upload Release Asset for macOS
run: |
cmake -E rename build/assets/xTools/xtools-macos-13.dmg build/assets/xTools/xtools-${{ github.ref_name }}-macos-13.dmg
ls && gh release upload ${{ github.ref_name }} 'build/assets/xTools/xtools-${{ github.ref_name }}-macos-13.dmg'
release-for-android:
runs-on: windows-2022
needs: update-release
steps:
- name: Checkout
uses: actions/checkout@v4
with:
# 切换至最新的tag,格式为v开头的版本号
ref: ${{ github.ref }}
- name: Install Qt for Android
uses: jurplel/install-qt-action@v4
with:
target: android
arch: android_armv7
host: windows
dir: ${{ github.workspace }}
modules: ${{env.QT_MODULES}}
version: '6.5.3'
- name: Install Qt for Desktop(mingw)
uses: jurplel/install-qt-action@v4
with:
target: desktop
arch: win64_mingw
host: windows
dir: ${{ github.workspace }}
modules: ${{env.QT_MODULES}}
version: '6.5.3'
- name: CMake for Android
shell: cmd
run: |
git fetch --tags
set JAVA_HOME=%JAVA_HOME_11_X64%
${{ github.workspace }}\Qt\6.5.3\android_armv7\bin\qt-cmake.bat ^
-G "MinGW Makefiles" ^
-S . ^
-B "build\armeabi_v7a" ^
-DQT_HOST_PATH:PATH="${{ github.workspace }}\Qt\6.5.3\mingw_64" ^
-DCMAKE_BUILD_TYPE:STRING=Release ^
-DCMAKE_CXX_COMPILER:FILEPATH="%ANDROID_NDK_ROOT%/toolchains/llvm/prebuilt/windows-x86_64/bin/clang++.exe" ^
-DANDROID_SDK_ROOT:PATH="%ANDROID_SDK_ROOT%" ^
-DANDROID_NDK_ROOT:PATH="%ANDROID_NDK_ROOT%" ^
-DBUILD_SHARED_LIBS:BOOL=OFF ^
-DWITH_TOOLS:BOOL=OFF
- name: Build for android
shell: cmd
run: |
set JAVA_HOME=%JAVA_HOME_11_X64%
echo %JAVA_HOME%
cmake --build build\armeabi_v7a --target xTools --config Release
- name: Copy File for Deploy
shell: cmd
run: |
mkdir build\armeabi_v7a\android-build\libs\armeabi-v7a
dir build\armeabi_v7a
copy .\build\armeabi_v7a\libxTools_armeabi-v7a.so .\build\armeabi_v7a\android-build\libs\armeabi-v7a /y
- name: Deploy for Android
shell: cmd
run: |
set JAVA_HOME=%JAVA_HOME_11_X64%
echo %JAVA_HOME%
${{ github.workspace }}\Qt\6.5.3\mingw_64\bin\androiddeployqt.exe ^
--input build\armeabi_v7a\android-xTools-deployment-settings.json ^
--output build\armeabi_v7a\android-build ^
--android-platform android-34 ^
--sign ${{ github.workspace }}\Resources\Platforms\Android\xTools.keystore xTools --storepass xTools --keypass xTools ^
--jdk %JAVA_HOME% --gradle --release
- name: Upload Release Asset for Android
run: |
cmake -E copy build/armeabi_v7a/android-build/build/outputs/apk/release/android-build-release-signed.apk xtools-android-armeabi_v7a.apk
cmake -E rename xtools-android-armeabi_v7a.apk xtools-${{ github.ref_name }}-android-armeabi_v7a.apk
ls && tree build/armeabi_v7a && gh release upload ${{ github.ref_name }} xtools-${{ github.ref_name }}-android-armeabi_v7a.apk