Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release: update homebrew deployment #1386

Merged
merged 1 commit into from
Aug 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 16 additions & 12 deletions .github/workflows/release-homebrew.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,21 @@ on:

jobs:
release:
runs-on: ubuntu-latest
runs-on: macos-latest
environment: release
env:
HOMEBREW_GITHUB_API_TOKEN: ${{ secrets.HOMEBREW_TOKEN }}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What permissions does this token require? Looks like it acts similarly to the old task (but works!) in that it'll create a fork, a branch in the fork, and the PR back to homebrew/cask.

This creates a personal remote repository that you can push to. This is needed because only Hombrew maintainers have push access to the main repositories.

https://docs.brew.sh/How-To-Open-a-Homebrew-Pull-Request#cask-related-pull-request

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, that's correct! Also, if the fork already exists, it just creates a new branch and the PR. Token-wise I made no changes, just used the one I'd already created for testing GCM's release workflows in my fork (which has the same permissions as the one in the main repo).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect. Just something to bear in mind the next time someone updates this token after expiration that it'll be their identity that the fork is created in.

steps:
- name: Update Homebrew tap
uses: mjcheetham/update-homebrew@v1.4
with:
token: ${{ secrets.HOMEBREW_TOKEN }}
tap: Homebrew/homebrew-cask
name: git-credential-manager
type: cask
alwaysUsePullRequest: true
releaseAsset: |
gcm-osx-x64-(.*)\.pkg
gcm-osx-arm64-(.*)\.pkg
- name: Open PR against homebrew/homebrew-cask
run: |
# Get latest version
version=$(curl --silent "https://api.github.com/repos/git-ecosystem/git-credential-manager/releases/latest" |
grep '"tag_name":' |
sed -E 's/.*"v([0-9\.]+).*/\1/')

# Ensure local Homebrew repository is up to date
cd "$(brew --repository homebrew/cask)"
git pull

# Open PR to update to latest version
brew bump-cask-pr git-credential-manager --version $version --no-audit --no-browse