Skip to content

Commit 0578f0c

Browse files
committed
♻️ Pull tap git commands up into workflow
1 parent 52c96db commit 0578f0c

File tree

4 files changed

+37
-55
lines changed

4 files changed

+37
-55
lines changed

.github/workflows/release.yml

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ jobs:
5656
run: |
5757
script/bootstrap -f
5858
59-
- name: 🔀 Create release branch
59+
- name: 🔀 Create mas release branch
6060
env:
6161
RELEASE_BRANCH: ${{ needs.start.outputs.release_branch }}
6262
run: |
@@ -83,7 +83,7 @@ jobs:
8383
git push \
8484
--set-upstream origin "${RELEASE_BRANCH}"
8585
86-
- name: ⤴️ Open PR
86+
- name: ⤴️ Open release PR
8787
env:
8888
GH_TOKEN: ${{ github.token }}
8989
MAS_VERSION: ${{ needs.start.outputs.mas_version }}
@@ -145,23 +145,25 @@ jobs:
145145
run: |
146146
script/bootstrap -f
147147
148-
- name: 🚰 Update mas tap formula
149-
env:
150-
GH_TOKEN: ${{ github.token }}
151-
DRY_RUN: ${{ needs.start.outputs.dry_run }}
152-
MAS_VERSION: ${{ needs.start.outputs.mas_version }}
153-
run: |
154-
DRY_RUN=${DRY_RUN} \
155-
script/brew_tap_update ${MAS_VERSION}
156-
157-
- name: Open mas tap PR
148+
- name: ⤴️ Open mas tap PR
158149
env:
159150
GH_TOKEN: ${{ github.token }}
160151
DRY_RUN: ${{ needs.start.outputs.dry_run }}
161152
RELEASE_BRANCH: ${{ needs.start.outputs.release_branch }}
162153
MAS_VERSION: ${{ needs.start.outputs.mas_version }}
163154
run: |
155+
brew tap mas-cli/tap
164156
cd "$(brew --repository mas-cli/tap)"
157+
git branch "${RELEASE_BRANCH}"
158+
git switch "${RELEASE_BRANCH}"
159+
160+
cp -v \
161+
${GITHUB_WORKSPACE}/Homebrew/mas-tap.rb \
162+
Formula/mas.rb
163+
164+
git add Formula/mas.rb
165+
git commit --message="🔖 Version ${MAS_VERSION}"
166+
165167
git push --set-upstream origin "${RELEASE_BRANCH}"
166168
gh pr create \
167169
--assignee phatblat \
@@ -171,6 +173,15 @@ jobs:
171173
--title "🔖 Version ${MAS_VERSION}" \
172174
--body "This PR contains the changes from releasing version [${MAS_VERSION}](https://github.com/mas-cli/mas/releases/tag/${MAS_VERSION})."
173175
176+
- name: 🚰 Update mas tap formula
177+
env:
178+
GH_TOKEN: ${{ github.token }}
179+
DRY_RUN: ${{ needs.start.outputs.dry_run }}
180+
MAS_VERSION: ${{ needs.start.outputs.mas_version }}
181+
run: |
182+
DRY_RUN=${DRY_RUN} \
183+
script/brew_tap_update ${MAS_VERSION}
184+
174185
- name: 🚀 Upload Bottles
175186
env:
176187
GH_TOKEN: ${{ github.token }}

script/bottle

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -82,18 +82,18 @@ OLD_FILENAME="mas--${MAS_VERSION}.${CURRENT_PLATFORM}.bottle.tar.gz"
8282
# Preflight checks
8383
#
8484

85-
# Uninstall if necessary
86-
brew remove mas 2>/dev/null || true
87-
brew remove mas-cli/tap/mas 2>/dev/null || true
85+
# # Uninstall if necessary
86+
# brew remove mas 2>/dev/null || true
87+
# brew remove mas-cli/tap/mas 2>/dev/null || true
8888

89-
# Uninstall if still found on path
90-
if command -v mas >/dev/null; then
91-
script/uninstall || true
92-
fi
89+
# # Uninstall if still found on path
90+
# if command -v mas >/dev/null; then
91+
# script/uninstall || true
92+
# fi
9393

9494
# Use formula from custom tap
95-
brew tap mas-cli/tap
96-
brew update
95+
# brew tap mas-cli/tap
96+
# brew update
9797

9898
# Audit formula
9999
brew audit --strict mas-cli/tap/mas
@@ -159,5 +159,3 @@ EOF
159159
rm "${OLD_FILENAME}"
160160
ls -l "${BOTTLE_DIR}"
161161
echo "${BOTTLE_BLOCK}"
162-
163-
brew remove mas-cli/tap/mas

script/brew_core_update

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@
1010
#
1111

1212
CORE_TAP_PATH="$(brew --repository homebrew/core)"
13-
CORE_FORMULA_PATH="${CORE_TAP_PATH}/Formula/"
14-
CORE_MAS_FORMULA_PATH="${CORE_FORMULA_PATH}/m/mas.rb"
13+
CORE_MAS_FORMULA_FILE="${CORE_TAP_PATH}/Formula/m/mas.rb"
1514

1615
PROJECT_PATH="$(git rev-parse --show-toplevel)"
1716
LOCAL_MAS_FORMULA_PATH="${PROJECT_PATH}/Homebrew/mas.rb"
@@ -99,7 +98,7 @@ brew update
9998
#
10099

101100
# Update mas formula in core (temporary)
102-
cp -v "${LOCAL_MAS_FORMULA_PATH}" "${CORE_MAS_FORMULA_PATH}"
101+
cp -v "${LOCAL_MAS_FORMULA_PATH}" "${CORE_MAS_FORMULA_FILE}"
103102

104103
# Install mas from source
105104
# HOMEBREW_NO_INSTALL_FROM_API:
@@ -127,7 +126,7 @@ popd
127126
#
128127

129128
# echo "Checking to see if this update can be a simple bump."
130-
# diff "${LOCAL_MAS_FORMULA_PATH}" "${CORE_MAS_FORMULA_PATH}"
129+
# diff "${LOCAL_MAS_FORMULA_PATH}" "${CORE_MAS_FORMULA_FILE}"
131130

132131
echo "==> 🧪 Updating homebrew-core formula mas (${MAS_VERSION}, ${REVISION})"
133132

@@ -154,7 +153,7 @@ if [[ $dry_run == '-d' ]]; then
154153
exit 0
155154
fi
156155

157-
pushd "${CORE_FORMULA_PATH}"
156+
pushd "${CORE_TAP_PATH}"
158157

159158
echo "Updating homebrew/core formula with a PR"
160159

script/brew_tap_update

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#
99

1010
MAS_TAP_PATH="$(brew --repository mas-cli/tap)"
11-
MAS_TAP_PATH_FORMULA="${MAS_TAP_PATH}/Formula/mas.rb"
11+
MAS_TAP_FORMULA_FILE="${MAS_TAP_PATH}/Formula/mas.rb"
1212

1313
PROJECT_PATH="$(git rev-parse --show-toplevel)"
1414
LOCAL_TAP_FORMULA_PATH="${PROJECT_PATH}/Homebrew/mas-tap.rb"
@@ -65,31 +65,5 @@ fi
6565

6666
echo "REVISION: ${REVISION}"
6767

68-
################################################################################
69-
#
70-
# Create branch on mas-cli/homebrew-tap
71-
#
72-
73-
# Ensure mas is tapped
74-
if ! [[ -d "${MAS_TAP_PATH}" ]]; then
75-
brew tap mas-cli/tap
76-
fi
77-
78-
pushd "${MAS_TAP_PATH}"
79-
80-
branch_name="releases/release-${MAS_VERSION}"
81-
$echo git branch "${branch_name}"
82-
$echo git switch "${branch_name}"
83-
84-
# Update tap formula version
85-
cp -v "${LOCAL_TAP_FORMULA_PATH}" "${MAS_TAP_PATH_FORMULA}"
86-
87-
$echo git add \
88-
"${MAS_TAP_PATH_FORMULA}"
89-
90-
$echo git commit --message="🔖 Version ${MAS_VERSION}"
91-
92-
popd
93-
9468
# Build in mas project
9569
script/bottle

0 commit comments

Comments
 (0)