1- name : Run a CMake build
1+ name : Build and Release
22
33on : [push]
44
77 BUILD_TYPE : Release
88
99jobs :
10- build :
10+ build_and_package :
1111 runs-on : ubuntu-24.04
1212
1313 steps :
14+
15+ # Tarball packaging
16+
17+ - uses : actions/checkout@v4
18+ with :
19+ fetch-depth : 0 # get entire history because we need tags for versioning
20+
21+ - name : Package Tarball
22+ working-directory : ${{runner.workspace}}/qarv
23+ shell : bash
24+ run : ./make_release ..
25+
26+ - name : Get Tarball Name
27+ working-directory : ${{runner.workspace}}
28+ run : " echo *.tar.xz | sed 's/^/tarball_package_name=/' >> $GITHUB_ENV"
29+
30+ - name : Store Tarball Artifact
31+ uses : actions/upload-artifact@v4
32+ with :
33+ name : ${{env.tarball_package_name}}
34+ path : ${{runner.workspace}}/${{env.tarball_package_name}}
35+ if-no-files-found : error
36+
37+ # Build
38+
1439 - name : Install prerequisites
1540 run : |
1641 sudo apt-get update -y -qq
@@ -21,18 +46,14 @@ jobs:
2146 libaravis-dev libusb-1.0-0-dev \
2247 doxygen graphviz
2348
24- - uses : actions/checkout@v4
25- with :
26- fetch-depth : 0 # get entire history because we need tags for versioning
27-
2849 - name : Create Build Environment
2950 run : cmake -E make_directory ${{runner.workspace}}/build
3051
3152 - name : Configure CMake
3253 shell : bash
3354 working-directory : ${{runner.workspace}}/build
34- # Note the current convention is to use the -S and -B options here to specify source
35- # and build directories, but this is only available with CMake 3.13 and higher.
55+ # Note the current convention is to use the -S and -B options here to specify source
56+ # and build directories, but this is only available with CMake 3.13 and higher.
3657 # The CMake binaries on the Github Actions machines are (as of this writing) 3.12
3758 run : cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_INSTALL_PREFIX=/usr
3859
@@ -41,18 +62,36 @@ jobs:
4162 shell : bash
4263 run : cmake --build . --config $BUILD_TYPE
4364
44-
4565 - name : Package
4666 working-directory : ${{runner.workspace}}/build
4767 run : cmake --build . --config $BUILD_TYPE --target package
4868
4969 - name : Get Package Name
5070 working-directory : ${{runner.workspace}}/build
51- run : " echo *.deb | sed 's/^/package_name =/' >> $GITHUB_ENV"
71+ run : " echo *.deb | sed 's/^/deb_package_name =/' >> $GITHUB_ENV"
5272
5373 - name : Store Package Artifact
5474 uses : actions/upload-artifact@v4
5575 with :
56- name : ${{env.package_name }}
57- path : ${{runner.workspace}}/build/${{env.package_name }}
76+ name : ${{env.deb_package_name }}
77+ path : ${{runner.workspace}}/build/${{env.deb_package_name }}
5878 if-no-files-found : error
79+
80+ # Create draft release - only on tags
81+
82+ - name : Create Draft Release
83+ if : startsWith(github.ref, 'refs/tags/')
84+ env :
85+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
86+ run : |
87+ gh release create ${{ github.ref_name }} \
88+ --draft \
89+ --generate-notes \
90+ ${{runner.workspace}}/build/${{env.deb_package_name}} \
91+ ${{runner.workspace}}/${{env.tarball_package_name}}
92+
93+ # Remove auto-generated source archives
94+ ref="${{ github.ref_name }}"
95+ for ass in "$ref".{zip,tar.gz} ; do
96+ gh release delete-asset "$ref" "$ass" --yes
97+ done
0 commit comments