Skip to content

Commit 8316a27

Browse files
authored
refactor(brew-bump): fix homebrew bump script (#5025)
* fix: source lib.sh in docker-buildx-push for tagging version * chore: use ubuntu and update git config homebrew job * refactor: simplify brew-bump.sh script * Revert "fix: source lib.sh in docker-buildx-push for tagging version" This reverts commit 2f7a361.
1 parent 18e19d2 commit 8316a27

File tree

2 files changed

+3
-76
lines changed

2 files changed

+3
-76
lines changed

.github/workflows/npm-brew.yaml

+3-11
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,8 @@ jobs:
4545
NPM_ENVIRONMENT: "production"
4646

4747
homebrew:
48-
# The newest version of code-server needs to be available on npm when this runs
49-
# otherwise, it will 404 and won't open a PR to bump version on homebrew/homebrew-core
5048
needs: npm
51-
runs-on: macos-latest
49+
runs-on: ubuntu-latest
5250
steps:
5351
# Ensure things are up to date
5452
# Suggested by homebrew maintainers
@@ -60,16 +58,10 @@ jobs:
6058
- name: Checkout code-server
6159
uses: actions/checkout@v3
6260

63-
- name: Checkout cdrci/homebrew-core
64-
uses: actions/checkout@v3
65-
with:
66-
repository: cdrci/homebrew-core
67-
path: homebrew-core
68-
6961
- name: Configure git
7062
run: |
71-
git config user.name github-actions
72-
git config user.email github-actions@github.com
63+
git config user.name cdrci
64+
git config user.email opensource@coder.com
7365
7466
- name: Bump code-server homebrew version
7567
env:

ci/steps/brew-bump.sh

-65
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
set -euo pipefail
33

44
main() {
5-
REPO="homebrew-core"
6-
GITHUB_USERNAME="cdrci"
7-
UPSTREAM_USERNAME_AND_REPO="Homebrew/$REPO"
85
# Only sourcing this so we get access to $VERSION
96
source ./ci/lib.sh
107
source ./ci/steps/steps-lib.sh
@@ -23,68 +20,6 @@ main() {
2320
exit 1
2421
fi
2522

26-
# Make sure the git clone step is successful
27-
if ! directory_exists "$REPO"; then
28-
echo "git clone failed. Cannot find $REPO directory."
29-
ls -la
30-
exit 1
31-
fi
32-
33-
echo "Changing into $REPO directory"
34-
pushd "$REPO" && pwd
35-
36-
echo "Adding $UPSTREAM_USERNAME_AND_REPO"
37-
git remote add upstream "https://github.com/$UPSTREAM_USERNAME_AND_REPO.git"
38-
39-
# Make sure the git remote step is successful
40-
if ! git config remote.upstream.url > /dev/null; then
41-
echo "git remote add upstream failed."
42-
echo "Could not find upstream in list of remotes."
43-
git remote -v
44-
exit 1
45-
fi
46-
47-
# TODO@jsjoeio - can I somehow check that this succeeded?
48-
echo "Fetching upstream $UPSTREAM_USERNAME_AND_REPO commits"
49-
git fetch upstream master
50-
51-
# TODO@jsjoeio - can I somehow check that this succeeded?
52-
echo "Merging in latest $UPSTREAM_USERNAME_AND_REPO changes branch master"
53-
git merge upstream/master
54-
55-
# GIT_ASKPASS lets us use the password when pushing without revealing it in the process list
56-
# See: https://serverfault.com/a/912788
57-
PATH_TO_GIT_ASKPASS="$HOME/git-askpass.sh"
58-
# Source: https://serverfault.com/a/912788
59-
# shellcheck disable=SC2016,SC2028
60-
echo 'echo $HOMEBREW_GITHUB_API_TOKEN' > "$PATH_TO_GIT_ASKPASS"
61-
62-
# Make sure the git-askpass.sh file creation is successful
63-
if ! file_exists "$PATH_TO_GIT_ASKPASS"; then
64-
echo "git-askpass.sh not found in $HOME."
65-
ls -la "$HOME"
66-
exit 1
67-
fi
68-
69-
# Ensure it's executable since we just created it
70-
chmod +x "$PATH_TO_GIT_ASKPASS"
71-
72-
# Make sure the git-askpass.sh file is executable
73-
if ! is_executable "$PATH_TO_GIT_ASKPASS"; then
74-
echo "$PATH_TO_GIT_ASKPASS is not executable."
75-
ls -la "$PATH_TO_GIT_ASKPASS"
76-
exit 1
77-
fi
78-
79-
# NOTE: we need to make sure our fork is up-to-date
80-
# otherwise, brew bump-formula-pr will use an
81-
# outdated base
82-
echo "Pushing changes to $GITHUB_USERNAME/$REPO fork on GitHub"
83-
# Export the variables so git sees them
84-
export HOMEBREW_GITHUB_API_TOKEN="$HOMEBREW_GITHUB_API_TOKEN"
85-
export GIT_ASKPASS="$PATH_TO_GIT_ASKPASS"
86-
git push "https://$GITHUB_USERNAME@github.com/$GITHUB_USERNAME/$REPO.git" --all
87-
8823
# Find the docs for bump-formula-pr here
8924
# https://github.com/Homebrew/brew/blob/master/Library/Homebrew/dev-cmd/bump-formula-pr.rb#L18
9025
local output

0 commit comments

Comments
 (0)