Skip to content

Commit 52c2fe6

Browse files
build(packaging): version number improvements
1 parent 5a40190 commit 52c2fe6

File tree

7 files changed

+52
-36
lines changed

7 files changed

+52
-36
lines changed

.github/workflows/ci-flatpak.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,14 +104,14 @@ jobs:
104104
run: |
105105
# variables for manifest
106106
branch="${{ github.head_ref }}"
107+
build_version=${{ inputs.release_tag }}
107108
commit=${{ inputs.release_commit }}
108109
109110
# check the branch variable
110111
if [ -z "$branch" ]
111112
then
112113
echo "This is a PUSH event"
113114
branch=${{ github.ref_name }}
114-
build_version=${{ inputs.release_tag }}
115115
clone_url=${{ github.event.repository.clone_url }}
116116
else
117117
echo "This is a PR event"
@@ -121,15 +121,17 @@ jobs:
121121
echo "Commit: ${commit}"
122122
echo "Clone URL: ${clone_url}"
123123
124+
export BRANCH=${branch}
125+
export BUILD_VERSION=${build_version}
126+
export CLONE_URL=${clone_url}
127+
export COMMIT=${commit}
128+
124129
mkdir -p build
125130
mkdir -p artifacts
126131
127132
cmake -DGITHUB_CLONE_URL=${clone_url} \
128133
-B build \
129134
-S . \
130-
-DBUILD_VERSION=${build_version} \
131-
-DGITHUB_BRANCH=${branch} \
132-
-DGITHUB_COMMIT=${commit} \
133135
-DSUNSHINE_CONFIGURE_FLATPAK_MAN=ON \
134136
-DSUNSHINE_CONFIGURE_ONLY=ON
135137

.github/workflows/ci-homebrew.yml

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -76,49 +76,45 @@ jobs:
7676
run: |
7777
# variables for formula
7878
branch="${{ github.head_ref }}"
79+
build_version=${{ inputs.release_version }}
7980
commit=${{ inputs.release_commit }}
8081
8182
# check the branch variable
8283
if [ -z "$branch" ]
8384
then
8485
echo "This is a PUSH event"
85-
build_version=${{ inputs.release_tag }}
8686
clone_url=${{ github.event.repository.clone_url }}
8787
branch="${{ github.ref_name }}"
8888
default_branch="${{ github.event.repository.default_branch }}"
8989
9090
if [ "${{ matrix.release }}" == "true" ]; then
9191
# we will publish the formula with the release tag
9292
tag="${{ inputs.release_tag }}"
93-
version="${{ inputs.release_version }}"
9493
else
9594
tag="${{ github.ref_name }}"
96-
version="0.0.${{ github.run_number }}"
9795
fi
9896
else
9997
echo "This is a PR event"
100-
build_version="0.0.${{ github.event.number }}"
10198
clone_url=${{ github.event.pull_request.head.repo.clone_url }}
10299
branch="${{ github.event.pull_request.head.ref }}"
103100
default_branch="${{ github.event.pull_request.head.repo.default_branch }}"
104101
tag="${{ github.event.pull_request.head.ref }}"
105-
version="0.0.${{ github.event.number }}"
106102
fi
107103
echo "Branch: ${branch}"
108104
echo "Clone URL: ${clone_url}"
109105
echo "Tag: ${tag}"
110106
107+
export BRANCH=${branch}
108+
export BUILD_VERSION=${build_version}
109+
export CLONE_URL=${clone_url}
110+
export COMMIT=${commit}
111+
export TAG=${tag}
112+
111113
mkdir -p build
112114
cmake \
113115
-B build \
114116
-S . \
115-
-DBUILD_VERSION="${build_version}" \
116-
-DFORMULA_VERSION="${version}" \
117-
-DGITHUB_BRANCH="${branch}" \
118-
-DGITHUB_COMMIT="${commit}" \
119-
-DGITHUB_CLONE_URL="${clone_url}" \
120117
-DGITHUB_DEFAULT_BRANCH="${default_branch}" \
121-
-DGITHUB_TAG="${tag}" \
122118
-DSUNSHINE_CONFIGURE_HOMEBREW=ON \
123119
-DSUNSHINE_CONFIGURE_ONLY=ON
124120
@@ -152,7 +148,7 @@ jobs:
152148
- name: Validate Homebrew Formula
153149
id: test
154150
if: matrix.release != true
155-
uses: LizardByte/actions/actions/release_homebrew@v2025.627.30023
151+
uses: LizardByte/actions/actions/release_homebrew@v2025.703.21447
156152
with:
157153
formula_file: ${{ github.workspace }}/homebrew/sunshine.rb
158154
git_email: ${{ secrets.GIT_EMAIL }}
@@ -229,7 +225,7 @@ jobs:
229225
github.repository_owner == 'LizardByte' &&
230226
matrix.release &&
231227
inputs.publish_release == 'true'
232-
uses: LizardByte/actions/actions/release_homebrew@v2025.627.30023
228+
uses: LizardByte/actions/actions/release_homebrew@v2025.703.21447
233229
with:
234230
formula_file: ${{ github.workspace }}/homebrew/sunshine-beta.rb
235231
git_email: ${{ secrets.GIT_EMAIL }}

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343

4444
- name: Release Setup
4545
id: release-setup
46-
uses: LizardByte/actions/actions/release_setup@v2025.627.30023
46+
uses: LizardByte/actions/actions/release_setup@v2025.703.21447
4747
with:
4848
github_token: ${{ secrets.GITHUB_TOKEN }}
4949

@@ -191,7 +191,7 @@ jobs:
191191
run: ls -l artifacts
192192

193193
- name: Create/Update GitHub Release
194-
uses: LizardByte/actions/actions/release_create@v2025.702.213340
194+
uses: LizardByte/actions/actions/release_create@v2025.703.21447
195195
with:
196196
allowUpdates: false
197197
body: ${{ needs.release-setup.outputs.release_body }}

cmake/prep/build_version.cmake

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,33 @@
1+
# Set build variables if env variables are defined
2+
# These are used in configured files such as manifests for different packages
3+
if(DEFINED ENV{BRANCH}) # cmake-lint: disable=W0106
4+
set(GITHUB_BRANCH $ENV{BRANCH})
5+
endif()
6+
if(DEFINED ENV{BUILD_VERSION}) # cmake-lint: disable=W0106
7+
set(BUILD_VERSION $ENV{BUILD_VERSION})
8+
endif()
9+
if(DEFINED ENV{CLONE_URL}) # cmake-lint: disable=W0106
10+
set(GITHUB_CLONE_URL $ENV{CLONE_URL})
11+
endif()
12+
if(DEFINED ENV{COMMIT}) # cmake-lint: disable=W0106
13+
set(GITHUB_COMMIT $ENV{COMMIT})
14+
endif()
15+
if(DEFINED ENV{TAG}) # cmake-lint: disable=W0106
16+
set(GITHUB_TAG $ENV{TAG})
17+
endif()
18+
119
# Check if env vars are defined before attempting to access them, variables will be defined even if blank
2-
if((DEFINED ENV{BRANCH}) AND (DEFINED ENV{BUILD_VERSION}) AND (DEFINED ENV{COMMIT})) # cmake-lint: disable=W0106
3-
if(($ENV{BRANCH} STREQUAL "master") AND (NOT $ENV{BUILD_VERSION} STREQUAL ""))
4-
# If BRANCH is "master" and BUILD_VERSION is not empty, then we are building a master branch
5-
MESSAGE("Got from CI master branch and version $ENV{BUILD_VERSION}")
20+
if((DEFINED ENV{BRANCH}) AND (DEFINED ENV{BUILD_VERSION})) # cmake-lint: disable=W0106
21+
if((DEFINED ENV{BRANCH}) AND (NOT $ENV{BUILD_VERSION} STREQUAL ""))
22+
# If BRANCH is defined and BUILD_VERSION is not empty, then we are building from CI
23+
# If BRANCH is master we are building a push/release build
24+
MESSAGE("Got from CI '$ENV{BRANCH}' branch and version '$ENV{BUILD_VERSION}'")
625
set(PROJECT_VERSION $ENV{BUILD_VERSION})
726
set(CMAKE_PROJECT_VERSION ${PROJECT_VERSION}) # cpack will use this to set the binary versions
8-
elseif((DEFINED ENV{BRANCH}) AND (DEFINED ENV{COMMIT}))
9-
# If BRANCH is set but not BUILD_VERSION we are building a PR, we gather only the commit hash
10-
MESSAGE("Got from CI $ENV{BRANCH} branch and commit $ENV{COMMIT}")
11-
set(PROJECT_VERSION ${PROJECT_VERSION}.$ENV{COMMIT})
1227
endif()
28+
else()
1329
# Generate Sunshine Version based of the git tag
1430
# https://github.com/nocnokneo/cmake-git-versioning-example/blob/master/LICENSE
15-
else()
1631
find_package(Git)
1732
if(GIT_EXECUTABLE)
1833
MESSAGE("${CMAKE_SOURCE_DIR}")
@@ -85,3 +100,9 @@ if(PROJECT_VERSION MATCHES "^([0-9]{4})[.]([0-9]{3,4})")
85100
set(PROJECT_DAY "0${PROJECT_DAY}")
86101
endif()
87102
endif()
103+
104+
message("PROJECT_VERSION: ${PROJECT_VERSION}")
105+
message("CMAKE_PROJECT_VERSION: ${CMAKE_PROJECT_VERSION}")
106+
message("PROJECT_YEAR: ${PROJECT_YEAR}")
107+
message("PROJECT_MONTH: ${PROJECT_MONTH}")
108+
message("PROJECT_DAY: ${PROJECT_DAY}")

docker/archlinux.dockerfile

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ ARG CLONE_URL
2828
ENV BRANCH=${BRANCH}
2929
ENV BUILD_VERSION=${BUILD_VERSION}
3030
ENV COMMIT=${COMMIT}
31+
ENV CLONE_URL=${CLONE_URL}
3132

3233
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
3334

@@ -74,13 +75,9 @@ else
7475
sub_version=""
7576
fi
7677
cmake \
78+
-DSUNSHINE_CONFIGURE_ONLY=ON \
7779
-DSUNSHINE_CONFIGURE_PKGBUILD=ON \
7880
-DSUNSHINE_SUB_VERSION="${sub_version}" \
79-
-DGITHUB_CLONE_URL="${CLONE_URL}" \
80-
-DGITHUB_BRANCH=${BRANCH} \
81-
-DGITHUB_BUILD_VERSION=${BUILD_VERSION} \
82-
-DGITHUB_COMMIT="${COMMIT}" \
83-
-DSUNSHINE_CONFIGURE_ONLY=ON \
8481
/build/sunshine
8582
_MAKE
8683

packaging/linux/Arch/PKGBUILD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ prepare() {
6767

6868
build() {
6969
export BRANCH="@GITHUB_BRANCH@"
70-
export BUILD_VERSION="@GITHUB_BUILD_VERSION@"
70+
export BUILD_VERSION="@BUILD_VERSION@"
7171
export COMMIT="@GITHUB_COMMIT@"
7272

7373
export CC="gcc-${_gcc_version}"

packaging/sunshine.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ class @PROJECT_NAME@ < Formula
66
homepage "@PROJECT_HOMEPAGE_URL@"
77
url "@GITHUB_CLONE_URL@",
88
tag: "@GITHUB_TAG@"
9-
version "@FORMULA_VERSION@"
9+
version "@BUILD_VERSION@"
1010
license all_of: ["GPL-3.0-only"]
1111
head "@GITHUB_CLONE_URL@", branch: "@GITHUB_DEFAULT_BRANCH@"
1212

@@ -201,7 +201,7 @@ class @PROJECT_NAME@ < Formula
201201

202202
def install
203203
ENV["BRANCH"] = "@GITHUB_BRANCH@"
204-
ENV["BUILD_VERSION"] = "@BUILD_VERSION@"
204+
ENV["BUILD_VERSION"] = "v@BUILD_VERSION@"
205205
ENV["COMMIT"] = "@GITHUB_COMMIT@"
206206

207207
args = %W[

0 commit comments

Comments
 (0)