Skip to content

Commit

Permalink
Merge pull request #538 from Homebrew/setup-homebrew-stable-fix
Browse files Browse the repository at this point in the history
setup-homebrew: handle stable on stable Docker images
  • Loading branch information
Bo98 committed May 17, 2024
2 parents 4b34604 + e05416b commit 677db44
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
13 changes: 13 additions & 0 deletions .github/workflows/setup-homebrew.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,31 @@ jobs:
include:
- os: macos-latest
key: macos
stable: false
- os: ubuntu-20.04
key: ubuntu-20
stable: false
- os: ubuntu-22.04
key: ubuntu-22
stable: false
- os: ubuntu-22.04
key: docker-root
stable: false
container:
image: ghcr.io/homebrew/ubuntu22.04:master
options: --user=root
- os: ubuntu-22.04
key: docker-linuxbrew
stable: false
container:
image: ghcr.io/homebrew/ubuntu22.04:master
options: --user=linuxbrew
- os: ubuntu-22.04
key: docker-linuxbrew-stable
stable: true
container:
image: ghcr.io/homebrew/ubuntu22.04:latest
options: --user=linuxbrew
runs-on: ${{ matrix.os }}
container: ${{ matrix.container }}
steps:
Expand Down Expand Up @@ -60,6 +71,8 @@ jobs:
- name: Set up Homebrew
id: set-up-homebrew
uses: ./setup-homebrew/
with:
stable: ${{ matrix.stable }}

- name: Cache Homebrew Bundler RubyGems
id: cache
Expand Down
7 changes: 6 additions & 1 deletion setup-homebrew/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,12 @@ if [[ "$GITHUB_REPOSITORY" =~ ^.+/brew$ ]]; then
echo "repository-path=$HOMEBREW_REPOSITORY" >>"$GITHUB_OUTPUT"
else
git_retry -C "$HOMEBREW_REPOSITORY" fetch --force --tags origin
git -C "$HOMEBREW_REPOSITORY" checkout --force -B master origin/HEAD
git_retry -C "$HOMEBREW_REPOSITORY" remote set-head origin --auto
if [[ "${STABLE}" == "true" && "$(git -C "$HOMEBREW_REPOSITORY" symbolic-ref --short HEAD 2>/dev/null)" != "master" ]]; then
git -C "$HOMEBREW_REPOSITORY" branch --force master origin/HEAD
else
git -C "$HOMEBREW_REPOSITORY" checkout --force -B master origin/HEAD
fi

if [[ -n "${HOMEBREW_TAP_REPOSITORY-}" ]]; then
echo "repository-path=$HOMEBREW_TAP_REPOSITORY" >>"$GITHUB_OUTPUT"
Expand Down

0 comments on commit 677db44

Please sign in to comment.