Skip to content

Commit

Permalink
fix: make version update check more robust (#2437)
Browse files Browse the repository at this point in the history
  • Loading branch information
ReenigneArcher authored Apr 18, 2024
1 parent c896dab commit 69191ca
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 5 deletions.
15 changes: 13 additions & 2 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ jobs:
then
echo "This is a PUSH event"
branch=${{ github.ref_name }}
build_version=${{ needs.check_changelog.outputs.next_version }}
commit=${{ github.sha }}
clone_url=${{ github.event.repository.clone_url }}
else
Expand All @@ -227,6 +228,7 @@ jobs:
cd build
cmake -DGITHUB_CLONE_URL=${clone_url} \
-DBUILD_VERSION=${build_version} \
-DGITHUB_BRANCH=${branch} \
-DGITHUB_COMMIT=${commit} \
-DSUNSHINE_CONFIGURE_FLATPAK_MAN=ON \
Expand Down Expand Up @@ -377,7 +379,7 @@ jobs:
- name: Build Linux
env:
BRANCH: ${{ github.head_ref || github.ref_name }}
BUILD_VERSION: ${{ needs.check_changelog.outputs.next_version_bare }}
BUILD_VERSION: ${{ needs.check_changelog.outputs.next_version }}
COMMIT: ${{ github.event.pull_request.head.sha || github.sha }}
timeout-minutes: 5
run: |
Expand Down Expand Up @@ -565,13 +567,16 @@ jobs:
if [ -z "$branch" ]
then
echo "This is a PUSH event"
build_version=${{ needs.check_changelog.outputs.next_version }}
clone_url=${{ github.event.repository.clone_url }}
branch="${{ github.ref_name }}"
commit=${{ github.sha }}
default_branch="${{ github.event.repository.default_branch }}"
else
echo "This is a PR event"
clone_url=${{ github.event.pull_request.head.repo.clone_url }}
branch="${{ github.event.pull_request.head.ref }}"
commit=${{ github.event.pull_request.head.sha }}
default_branch="${{ github.event.pull_request.head.repo.default_branch }}"
fi
echo "Branch: ${branch}"
Expand All @@ -580,7 +585,9 @@ jobs:
mkdir build
cd build
cmake \
-DBUILD_VERSION="${build_version}" \
-DGITHUB_BRANCH="${branch}" \
-DGITHUB_COMMIT="${commit}" \
-DGITHUB_CLONE_URL="${clone_url}" \
-DGITHUB_DEFAULT_BRANCH="${default_branch}" \
-DSUNSHINE_CONFIGURE_HOMEBREW=ON \
Expand Down Expand Up @@ -678,6 +685,8 @@ jobs:
if [ -z "$branch" ]
then
echo "This is a PUSH event"
branch="${{ github.ref_name }}"
build_version=${{ needs.check_changelog.outputs.next_version }}
commit=${{ github.sha }}
clone_url=${{ github.event.repository.clone_url }}
else
Expand All @@ -691,6 +700,8 @@ jobs:
mkdir build
cd build
cmake \
-DBUILD_VERSION=${build_version} \
-DGITHUB_BRANCH=${branch} \
-DGITHUB_COMMIT=${commit} \
-DGITHUB_CLONE_URL=${clone_url} \
-DSUNSHINE_CONFIGURE_PORTFILE=ON \
Expand Down Expand Up @@ -1024,7 +1035,7 @@ jobs:
shell: msys2 {0}
env:
BRANCH: ${{ github.head_ref || github.ref_name }}
BUILD_VERSION: ${{ needs.check_changelog.outputs.next_version_bare }}
BUILD_VERSION: ${{ needs.check_changelog.outputs.next_version }}
COMMIT: ${{ github.event.pull_request.head.sha || github.sha }}
run: |
mkdir build
Expand Down
3 changes: 3 additions & 0 deletions packaging/linux/flatpak/dev.lizardbyte.sunshine.yml
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,9 @@ modules:
build-args:
- --share=network
env:
BUILD_VERSION: "@BUILD_VERSION@"
BRANCH: "@GITHUB_BRANCH@"
COMMIT: "@GITHUB_COMMIT@"
npm_config_nodedir: /usr/lib/sdk/node18
NPM_CONFIG_LOGLEVEL: info
config-opts:
Expand Down
4 changes: 4 additions & 0 deletions packaging/macos/Portfile
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ configure.args -DBUILD_WERROR=ON \
-DCMAKE_INSTALL_PREFIX=${prefix} \
-DSUNSHINE_ASSETS_DIR=etc/sunshine/assets

configure.env-append BRANCH=@GITHUB_BRANCH@
configure.env-append BUILD_VERSION=@BUILD_VERSION@
configure.env-append COMMIT=@GITHUB_COMMIT@

startupitem.create yes
startupitem.executable "${prefix}/bin/{$name}"
startupitem.location LaunchDaemons
Expand Down
4 changes: 4 additions & 0 deletions packaging/macos/sunshine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ class @PROJECT_NAME@ < Formula
depends_on "opus"

def install
ENV["BRANCH"] = "@GITHUB_BRANCH@"
ENV["BUILD_VERSION"] = "@BUILD_VERSION@"
ENV["COMMIT"] = "@GITHUB_COMMIT@"

args = %W[
-DBUILD_WERROR=ON
-DCMAKE_INSTALL_PREFIX=#{prefix}
Expand Down
12 changes: 9 additions & 3 deletions src_assets/common/assets/web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,16 @@ <h3>{{githubVersion.name}}</h3>
stableBuildAvailable() {
// If we can't get versions, return false
if (!this.githubVersion || !this.version) return false;

// Get the GitHub version tag
let v = this.githubVersion.name;
let v_github = this.githubVersion.name;
// If the version starts with a v, remove it
if (v_github.indexOf("v") === 0) v_github = v_github.substring(1);

// Get the current version
let v_this = this.version;
// If the version starts with a v, remove it
if (v.indexOf("v") === 0) v = v.substring(1);
if (v_this.indexOf("v") === 0) v_this = v_this.substring(1);

// if nightly or dirty, we do an additional check to make sure it's an actual upgrade.
if (this.buildVersionIsNightly || this.buildVersionIsDirty) {
Expand All @@ -124,7 +130,7 @@ <h3>{{githubVersion.name}}</h3>
}

// return true if the version is different, otherwise false
return v !== this.version;
return v_github !== v_this;
},
nightlyBuildAvailable() {
// Verify nightly data is available and the build version is not stable
Expand Down

0 comments on commit 69191ca

Please sign in to comment.