Skip to content

Commit d3e907a

Browse files
alphonsomclaude
andcommitted
ci: release-on-tag job + version overridable from tag
Push a v* tag to build the packages with the tag's version (-DCOMMAND8_VERSION, e.g. v1.2.3 -> command8-1.2.3-Linux.deb) and attach the .deb and .tar.gz to a generated GitHub Release. The build job now skips tag refs so the two don't overlap. CPACK_PACKAGE_VERSION now derives from a COMMAND8_VERSION cache var (default 0.1.0) so releases are versioned coherently. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent ee83907 commit d3e907a

2 files changed

Lines changed: 48 additions & 1 deletion

File tree

‎.github/workflows/ci.yml‎

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,15 @@ name: CI
44
on:
55
push:
66
branches: [main]
7+
tags: ['v*']
78
pull_request:
89
branches: [main]
910

1011
jobs:
1112
build:
1213
name: build + test + package
14+
# Branches and PRs only; tag pushes are handled by the release job below.
15+
if: github.event_name == 'pull_request' || startsWith(github.ref, 'refs/heads/')
1316
runs-on: ubuntu-latest
1417
steps:
1518
- uses: actions/checkout@v4
@@ -43,3 +46,45 @@ jobs:
4346
build/command8-*-Linux.deb
4447
build/command8-*-Linux.tar.gz
4548
if-no-files-found: error
49+
50+
release:
51+
name: release on tag
52+
# Runs only for pushed v* tags; builds with the version taken from the tag.
53+
if: startsWith(github.ref, 'refs/tags/v')
54+
runs-on: ubuntu-latest
55+
permissions:
56+
contents: write # to create the GitHub Release
57+
steps:
58+
- uses: actions/checkout@v4
59+
60+
- name: Install build dependencies
61+
run: |
62+
sudo apt-get update
63+
sudo apt-get install -y --no-install-recommends \
64+
cmake g++ pkg-config libasound2-dev liblo-dev lintian file
65+
66+
- name: Derive version from tag
67+
run: echo "VERSION=${GITHUB_REF_NAME#v}" >> "$GITHUB_ENV" # v1.2.3 -> 1.2.3
68+
69+
- name: Configure
70+
run: cmake -B build -DCMAKE_BUILD_TYPE=Release -DCOMMAND8_VERSION="$VERSION"
71+
72+
- name: Build
73+
run: cmake --build build --parallel
74+
75+
- name: Test
76+
run: ctest --test-dir build --output-on-failure
77+
78+
- name: Package (.deb + .tar.gz)
79+
run: cmake --build build --target package
80+
81+
- name: Lint the .deb
82+
run: lintian --fail-on error,warning build/command8-*-Linux.deb
83+
84+
- name: Create GitHub Release
85+
env:
86+
GH_TOKEN: ${{ github.token }}
87+
run: |
88+
gh release create "$GITHUB_REF_NAME" \
89+
build/command8-*-Linux.deb build/command8-*-Linux.tar.gz \
90+
--title "$GITHUB_REF_NAME" --generate-notes

‎CMakeLists.txt‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,9 @@ endif()
134134

135135
# --- packaging (CPack: .deb + .tar.gz) ---
136136
set(CPACK_PACKAGE_NAME command8)
137-
set(CPACK_PACKAGE_VERSION "0.1.0")
137+
# Overridable from the release tag: cmake -B build -DCOMMAND8_VERSION=1.2.3
138+
set(COMMAND8_VERSION "0.1.0" CACHE STRING "Package version (x.y.z)")
139+
set(CPACK_PACKAGE_VERSION "${COMMAND8_VERSION}")
138140
set(CPACK_PACKAGE_CONTACT "Alphonso Mango <alphonso.mango@outlook.com>")
139141
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY
140142
"native C++ engine for the Digidesign Command|8 control surface")

0 commit comments

Comments
 (0)