Skip to content

Commit

Permalink
fix(homebrew): use tag instead of branch in formula (#2705)
Browse files Browse the repository at this point in the history
  • Loading branch information
ReenigneArcher authored Jun 16, 2024
1 parent 750255d commit a5a1988
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
20 changes: 18 additions & 2 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -493,8 +493,10 @@ jobs:
os_name: "macos"
- os_version: "latest"
os_name: "ubuntu"
- os_version: "latest" # this job will only configure the formula for release, no validation
os_name: "ubuntu"
release: true
name: Homebrew (${{ matrix.os_name }}-${{ matrix.os_version }})
name: Homebrew (${{ matrix.os_name }}-${{ matrix.os_version }}${{ matrix.release == true && ' (Release)' || '' }})
runs-on: ${{ matrix.os_name }}-${{ matrix.os_version }}

steps:
Expand All @@ -515,14 +517,23 @@ jobs:
clone_url=${{ github.event.repository.clone_url }}
branch="${{ github.ref_name }}"
default_branch="${{ github.event.repository.default_branch }}"
if [ "${{ matrix.release }}" == "true" ]; then
# we will publish the formula with the release tag
tag="${{ needs.setup_release.outputs.release_tag }}"
else
tag="${{ github.sha }}"
fi
else
echo "This is a PR event"
clone_url=${{ github.event.pull_request.head.repo.clone_url }}
branch="${{ github.event.pull_request.head.ref }}"
default_branch="${{ github.event.pull_request.head.repo.default_branch }}"
tag="${{ github.event.pull_request.head.ref }}"
fi
echo "Branch: ${branch}"
echo "Clone URL: ${clone_url}"
echo "Tag: ${tag}"
mkdir build
cd build
Expand All @@ -532,6 +543,7 @@ jobs:
-DGITHUB_COMMIT="${commit}" \
-DGITHUB_CLONE_URL="${clone_url}" \
-DGITHUB_DEFAULT_BRANCH="${default_branch}" \
-DGITHUB_TAG="${tag}" \
-DSUNSHINE_CONFIGURE_HOMEBREW=ON \
-DSUNSHINE_CONFIGURE_ONLY=ON \
..
Expand All @@ -552,7 +564,9 @@ jobs:
path: homebrew/

- name: Setup Xvfb
if: ${{ runner.os == 'Linux' }}
if: |
matrix.release != true &&
runner.os == 'Linux'
run: |
sudo apt-get update -y
sudo apt-get install -y \
Expand All @@ -564,6 +578,8 @@ jobs:
echo "DISPLAY=${DISPLAY}" >> $GITHUB_ENV
- name: Validate Homebrew Formula
if: |
matrix.release != true
uses: LizardByte/homebrew-release-action@v2024.612.21058
with:
formula_file: ${{ github.workspace }}/homebrew/sunshine.rb
Expand Down
2 changes: 1 addition & 1 deletion packaging/sunshine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class @PROJECT_NAME@ < Formula
desc "@PROJECT_DESCRIPTION@"
homepage "@PROJECT_HOMEPAGE_URL@"
url "@GITHUB_CLONE_URL@",
tag: "@GITHUB_BRANCH@"
tag: "@GITHUB_TAG@"
version "@PROJECT_VERSION@"
license all_of: ["GPL-3.0-only"]
head "@GITHUB_CLONE_URL@", branch: "@GITHUB_DEFAULT_BRANCH@"
Expand Down

0 comments on commit a5a1988

Please sign in to comment.