@@ -2,13 +2,12 @@ name: Build and Release
22
33on :
44 push :
5- branches : [ main, develop ]
6- tags :
7- - ' v*'
8- pull_request :
9- branches : [ main, develop ]
5+ tags : [ 'v*' ]
106 workflow_dispatch :
117
8+ permissions :
9+ contents : write
10+
1211env :
1312 CMAKE_VERSION : " 3.28.0"
1413 QT_VERSION : " 6.9.3"
@@ -19,194 +18,147 @@ jobs:
1918 fail-fast : false
2019 matrix :
2120 include :
22- # Windows MSVC builds
2321 - name : " Windows MSVC 2022 x64"
2422 os : windows-2022
2523 preset : " windows-msvc-x64-release"
26- cmake_generator : " Visual Studio 17 2022"
27- cmake_platform : " x64"
24+ generator : " Visual Studio 17 2022"
25+ platform : " x64"
2826 qt_arch : " win64_msvc2022_64"
2927 artifact_prefix : " windows-msvc-x64"
3028
31- # macOS builds
3229 - name : " macOS x86_64 (Intel)"
3330 os : macos-13
3431 preset : " macos-x64-release"
35- cmake_generator : " Ninja"
36- cmake_build_type : " Release"
32+ generator : " Ninja"
33+ build_type : " Release"
3734 qt_arch : " clang_64"
3835 artifact_prefix : " macos-x64"
3936
40- # Linux builds
4137 - name : " Linux x64"
4238 os : ubuntu-22.04
4339 preset : " linux-x64-release"
44- cmake_generator : " Ninja"
45- cmake_build_type : " Release"
40+ generator : " Ninja"
41+ build_type : " Release"
4642 qt_arch : " linux_gcc_64"
4743 artifact_prefix : " linux-x64"
4844
49- # ARM Linux builds
5045 - name : " ARM Linux (aarch64)"
5146 os : ubuntu-22.04
5247 preset : " linux-arm64-release"
53- cmake_generator : " Ninja"
54- cmake_build_type : " Release"
48+ generator : " Ninja"
49+ build_type : " Release"
5550 qt_arch : " linux_gcc_arm64"
5651 artifact_prefix : " linux-arm64"
5752
5853 runs-on : ${{ matrix.os }}
5954 name : ${{ matrix.name }}
6055
6156 steps :
62- - name : Checkout code
57+ - name : Checkout repository
6358 uses : actions/checkout@v4
6459 with :
6560 fetch-depth : 0
6661
67- - name : Install Qt (Windows)
62+ # Dependencies
63+ - name : Install dependencies
64+ run : |
65+ if [ "${{ runner.os }}" == "Linux" ]; then
66+ sudo apt-get update
67+ sudo apt-get install -y ninja-build cmake build-essential libgl1-mesa-dev libglu1-mesa-dev libegl1-mesa-dev qt6-base-dev qt6-base-dev-tools
68+ elif [ "${{ runner.os }}" == "macOS" ]; then
69+ brew install ninja cmake
70+ fi
71+ shell : bash
72+
73+ - name : Install dependencies (Windows)
6874 if : runner.os == 'Windows'
69- uses : jurplel/install-qt-action@v4
70- with :
71- version : ${{ env.QT_VERSION }}
72- arch : ${{ matrix.qt_arch }}
73- cache : ' true'
75+ run : choco install ninja cmake -y
7476
75- - name : Install Qt (macOS)
76- if : runner.os == 'macOS'
77+ # Qt setup
78+ - name : Install Qt (Windows/macOS)
79+ if : runner.os != 'Linux'
7780 uses : jurplel/install-qt-action@v4
7881 with :
7982 version : ${{ env.QT_VERSION }}
8083 arch : ${{ matrix.qt_arch }}
81- cache : ' true'
82-
83- - name : Install Qt (Linux)
84- if : runner.os == 'Linux'
85- run : |
86- sudo apt-get update
87- sudo apt-get install -y qt6-base-dev qt6-base-dev-tools
88-
89- - name : Install dependencies (Windows)
90- if : runner.os == 'Windows'
91- run : |
92- choco install ninja cmake -y
93-
94- - name : Install dependencies (macOS)
95- if : runner.os == 'macOS'
96- run : |
97- brew install ninja cmake
98-
99- - name : Install dependencies (Linux)
100- if : runner.os == 'Linux'
101- run : |
102- sudo apt-get update
103- sudo apt-get install -y ninja-build cmake build-essential libgl1-mesa-dev libglu1-mesa-dev libegl1-mesa-dev
84+ cache : true
10485
105- - name : Create build directory
106- run : cmake -E make_directory ${{ github.workspace }}/build
107-
108- - name : Configure CMake (Windows)
109- if : runner.os == 'Windows'
110- shell : cmd
111- run : |
112- cd ${{ github.workspace }}/build
113- cmake -G "${{ matrix.cmake_generator }}" ^
114- -A ${{ matrix.cmake_platform }} ^
115- -DCMAKE_BUILD_TYPE=Release ^
116- -DBUILD_EXAMPLES=ON ^
117- -DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/install" ^
118- ..
119-
120- - name : Configure CMake (non-Windows)
121- if : runner.os != 'Windows'
86+ # 🏗Build
87+ - name : Configure CMake
12288 run : |
123- cd ${{ github.workspace }}/build
124- cmake -G "${{ matrix.cmake_generator }}" \
125- -DCMAKE_BUILD_TYPE=${{ matrix.cmake_build_type }} \
126- -DBUILD_EXAMPLES=ON \
127- -DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/install" \
128- ..
89+ cmake -E make_directory build
90+ cd build
91+ if [ "${{ runner.os }}" == "Windows" ]; then
92+ cmake -G "${{ matrix.generator }}" -A ${{ matrix.platform }} \
93+ -DCMAKE_BUILD_TYPE=Release \
94+ -DBUILD_EXAMPLES=ON \
95+ -DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/install" \
96+ ..
97+ else
98+ cmake -G "${{ matrix.generator }}" \
99+ -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
100+ -DBUILD_EXAMPLES=ON \
101+ -DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/install" \
102+ ..
103+ fi
104+ shell : bash
129105
130106 - name : Build
131- run : cmake --build ${{ github.workspace }}/ build --config Release --parallel
107+ run : cmake --build build --config Release --parallel
132108
133109 - name : Install
134- run : cmake --install ${{ github.workspace }}/ build --config Release
110+ run : cmake --install build --config Release
135111
136- - name : Create package (Windows)
137- if : runner.os == 'Windows'
138- shell : cmd
112+ # Packaging
113+ - name : Package artifacts
139114 run : |
140- cd ${{ github.workspace }}/ build
141- cpack -C Release -G NSIS
142-
143- - name : Create package (macOS)
144- if : runner.os == 'macOS'
145- run : |
146- cd ${{ github.workspace }}/build
147- cpack -C Release -G DragNDrop
148- cpack -C Release -G TGZ
149-
150- - name : Create package (Linux)
151- if : runner.os == 'Linux'
152- run : |
153- cd ${{ github.workspace }}/build
154- cpack -C Release -G DEB
155- cpack -C Release -G RPM
156- cpack -C Release -G TGZ
157-
158- - name : Upload artifacts
115+ cd build
116+ case "${{ runner.os }}" in
117+ Windows)
118+ cpack -C Release -G NSIS
119+ ;;
120+ macOS)
121+ cpack -C Release -G DragNDrop
122+ cpack -C Release -G TGZ
123+ ;;
124+ Linux)
125+ cpack -C Release -G DEB
126+ cpack -C Release -G RPM
127+ cpack -C Release -G TGZ
128+ ;;
129+ esac
130+ shell : bash
131+
132+ # Upload packages
133+ - name : Upload build artifacts
159134 uses : actions/upload-artifact@v4
160135 with :
161136 name : ${{ matrix.artifact_prefix }}-packages
162- path : ${{ github.workspace }}/build/QTradingView-*
163- retention-days : 30
164-
165- - name : Generate checksums (Windows)
166- if : runner.os == 'Windows'
167- shell : pwsh
168- run : |
169- Get-ChildItem -File "QTradingView-*" | ForEach-Object {
170- Get-FileHash $_.FullName -Algorithm SHA256 |
171- ForEach-Object { $_.Hash | Out-File ($_.Path + ".sha256") -Encoding ascii }
172- }
173-
174- - name : Generate checksums (Linux/macOS)
175- if : runner.os != 'Windows'
176- run : |
177- cd ${{ github.workspace }}/build
178- find . -maxdepth 1 -name "QTradingView-*" -type f -exec sh -c 'sha256sum "$1" > "$1.sha256"' _ {} \;
179-
180-
181- - name : Upload checksums
182- # if: startsWith(github.ref, 'refs/tags/')
183- uses : actions/upload-artifact@v4
184- with :
185- name : ${{ matrix.artifact_prefix }}-checksums
186- path : ${{ github.workspace }}/build/*.sha256
137+ path : build/QTradingView-*
187138 retention-days : 30
188139
189140 release :
190141 needs : build
191142 runs-on : ubuntu-latest
192- # if: startsWith(github.ref, 'refs/tags/')
193- name : Create Release
143+ name : Create GitHub Release
144+ if : startsWith(github.ref, 'refs/tags/')
194145
195146 steps :
196- - name : Checkout code
147+ - name : Checkout repository
197148 uses : actions/checkout@v4
198149
199150 - name : Download all artifacts
200151 uses : actions/download-artifact@v4
201152 with :
202153 path : artifacts
203154
204- - name : Create Release
205- uses : softprops/action-gh-release@v1
155+ - name : Create GitHub Release
156+ uses : softprops/action-gh-release@v2
206157 with :
207158 draft : false
208159 prerelease : false
209160 generate_release_notes : true
210161 files : artifacts/**/*
162+ replace : true
211163 env :
212164 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments