@@ -12,6 +12,8 @@ concurrency:
1212 group : ${{ github.workflow }}-${{ github.ref }}
1313 cancel-in-progress : true
1414
15+ permissions :
16+ contents : write
1517jobs :
1618 build-test :
1719 strategy :
4042 libopencv-dev \
4143 doxygen graphviz \
4244 libyaml-cpp-dev \
43- ccache
45+ ccache \
46+ dpkg-dev fakeroot
4447
4548 - name : Enable ccache (Ubuntu)
4649 if : matrix.os == 'ubuntu-latest'
@@ -99,7 +102,17 @@ jobs:
99102 echo "VCPKG_TARGET_TRIPLET=x64-windows" >> $env:GITHUB_ENV
100103 echo "VCPKG_HOST_TRIPLET=x64-windows" >> $env:GITHUB_ENV
101104
102- # -------- Configure --------
105+ # Tag inference mechanism
106+ - name : Derive version from tag (or fallback)
107+ shell : bash
108+ run : |
109+ if [[ "${GITHUB_REF}" == refs/tags/v* ]]; then
110+ echo "PKG_VERSION=${GITHUB_REF_NAME#v}" >> $GITHUB_ENV
111+ else
112+ echo "PKG_VERSION=${{ env.BUILD_TYPE }}-snapshot" >> $GITHUB_ENV
113+ fi
114+
115+ # -------- Configure --------
103116 - name : Configure (CMake)
104117 shell : pwsh
105118 run : |
@@ -108,6 +121,7 @@ jobs:
108121 "-G", "Ninja",
109122 "-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }}",
110123 "-DBUILD_TESTS=ON",
124+ "-DPROJECT_VERSION=${{ env.PKG_VERSION }}",
111125 "-DCMAKE_RUNTIME_OUTPUT_DIRECTORY=build/bin",
112126 "-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=build/lib",
113127 "-DCMAKE_ARCHIVE_OUTPUT_DIRECTORY=build/lib"
@@ -150,14 +164,6 @@ jobs:
150164 if-no-files-found : ignore
151165 retention-days : 30
152166
153- # -------- Package (CPack) --------
154- # - name: CPack (package binaries)
155- # if: (github.ref == 'refs/heads/master') || startsWith(github.ref, 'refs/tags/v')
156- # working-directory: build
157- # run: |
158- # cpack -G ZIP
159- # cpack -G TGZ
160-
161167 # -------- Package (CPack via CMake target) --------
162168 - name : Package (CPack)
163169 if : (github.ref == 'refs/heads/master') || startsWith(github.ref, 'refs/tags/v')
@@ -176,9 +182,10 @@ jobs:
176182 build/bin/**/*.pdb
177183 build/lib/**/*.lib
178184 build/*.zip
179- retention-days : 30
185+ build/*.tar.gz
186+ retention-days : 14
180187
181- - name : Upload artifacts (Linux TGZ )
188+ - name : Upload artifacts (Linux packages )
182189 if : (matrix.os == 'ubuntu-latest') && ((github.ref == 'refs/heads/master') || startsWith(github.ref, 'refs/tags/v'))
183190 uses : actions/upload-artifact@v4
184191 with :
@@ -187,4 +194,41 @@ jobs:
187194 build/bin/videostrip_cli
188195 build/lib/**/*.a
189196 build/*.tar.gz
197+ build/*.deb
190198 retention-days : 14
199+
200+ release :
201+ if : startsWith(github.ref, 'refs/tags/v') # only on tag like v0.7.0
202+ needs : [ build-test ] # wait for matrix to finish
203+ runs-on : ubuntu-latest
204+
205+ steps :
206+ - name : Download Windows artifacts
207+ uses : actions/download-artifact@v4
208+ with :
209+ name : videostrip-windows-Release
210+ path : artifacts/windows
211+
212+ - name : Download Linux artifacts
213+ uses : actions/download-artifact@v4
214+ with :
215+ name : videostrip-linux-Release
216+ path : artifacts/linux
217+
218+ - name : List files
219+ run : find artifacts -type f -maxdepth 3 -printf "%p\n"
220+
221+ - name : Publish GitHub Release
222+ uses : softprops/action-gh-release@v2
223+ with :
224+ tag_name : ${{ github.ref_name }}
225+ name : ${{ github.ref_name }}
226+ draft : false
227+ prerelease : false
228+ files : |
229+ artifacts/windows/*.zip
230+ artifacts/windows/*.tar.gz
231+ artifacts/linux/*.tar.gz
232+ artifacts/linux/*.deb
233+ env :
234+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments