♻️ Pull tap git commands up into workflow

This commit is contained in:
Ben Chatelain 2024-07-31 21:04:54 -06:00
parent 52c96db818
commit 0578f0c850
No known key found for this signature in database
4 changed files with 37 additions and 55 deletions

View file

@ -56,7 +56,7 @@ jobs:
run: |
script/bootstrap -f
- name: 🔀 Create release branch
- name: 🔀 Create mas release branch
env:
RELEASE_BRANCH: ${{ needs.start.outputs.release_branch }}
run: |
@ -83,7 +83,7 @@ jobs:
git push \
--set-upstream origin "${RELEASE_BRANCH}"
- name: ⤴️ Open PR
- name: ⤴️ Open release PR
env:
GH_TOKEN: ${{ github.token }}
MAS_VERSION: ${{ needs.start.outputs.mas_version }}
@ -145,23 +145,25 @@ jobs:
run: |
script/bootstrap -f
- name: 🚰 Update mas tap formula
env:
GH_TOKEN: ${{ github.token }}
DRY_RUN: ${{ needs.start.outputs.dry_run }}
MAS_VERSION: ${{ needs.start.outputs.mas_version }}
run: |
DRY_RUN=${DRY_RUN} \
script/brew_tap_update ${MAS_VERSION}
- name: Open mas tap PR
- name: ⤴️ Open mas tap PR
env:
GH_TOKEN: ${{ github.token }}
DRY_RUN: ${{ needs.start.outputs.dry_run }}
RELEASE_BRANCH: ${{ needs.start.outputs.release_branch }}
MAS_VERSION: ${{ needs.start.outputs.mas_version }}
run: |
brew tap mas-cli/tap
cd "$(brew --repository mas-cli/tap)"
git branch "${RELEASE_BRANCH}"
git switch "${RELEASE_BRANCH}"
cp -v \
${GITHUB_WORKSPACE}/Homebrew/mas-tap.rb \
Formula/mas.rb
git add Formula/mas.rb
git commit --message="🔖 Version ${MAS_VERSION}"
git push --set-upstream origin "${RELEASE_BRANCH}"
gh pr create \
--assignee phatblat \
@ -171,6 +173,15 @@ jobs:
--title "🔖 Version ${MAS_VERSION}" \
--body "This PR contains the changes from releasing version [${MAS_VERSION}](https://github.com/mas-cli/mas/releases/tag/${MAS_VERSION})."
- name: 🚰 Update mas tap formula
env:
GH_TOKEN: ${{ github.token }}
DRY_RUN: ${{ needs.start.outputs.dry_run }}
MAS_VERSION: ${{ needs.start.outputs.mas_version }}
run: |
DRY_RUN=${DRY_RUN} \
script/brew_tap_update ${MAS_VERSION}
- name: 🚀 Upload Bottles
env:
GH_TOKEN: ${{ github.token }}

View file

@ -82,18 +82,18 @@ OLD_FILENAME="mas--${MAS_VERSION}.${CURRENT_PLATFORM}.bottle.tar.gz"
# Preflight checks
#
# Uninstall if necessary
brew remove mas 2>/dev/null || true
brew remove mas-cli/tap/mas 2>/dev/null || true
# # Uninstall if necessary
# brew remove mas 2>/dev/null || true
# brew remove mas-cli/tap/mas 2>/dev/null || true
# Uninstall if still found on path
if command -v mas >/dev/null; then
script/uninstall || true
fi
# # Uninstall if still found on path
# if command -v mas >/dev/null; then
# script/uninstall || true
# fi
# Use formula from custom tap
brew tap mas-cli/tap
brew update
# brew tap mas-cli/tap
# brew update
# Audit formula
brew audit --strict mas-cli/tap/mas
@ -159,5 +159,3 @@ EOF
rm "${OLD_FILENAME}"
ls -l "${BOTTLE_DIR}"
echo "${BOTTLE_BLOCK}"
brew remove mas-cli/tap/mas

View file

@ -10,8 +10,7 @@
#
CORE_TAP_PATH="$(brew --repository homebrew/core)"
CORE_FORMULA_PATH="${CORE_TAP_PATH}/Formula/"
CORE_MAS_FORMULA_PATH="${CORE_FORMULA_PATH}/m/mas.rb"
CORE_MAS_FORMULA_FILE="${CORE_TAP_PATH}/Formula/m/mas.rb"
PROJECT_PATH="$(git rev-parse --show-toplevel)"
LOCAL_MAS_FORMULA_PATH="${PROJECT_PATH}/Homebrew/mas.rb"
@ -99,7 +98,7 @@ brew update
#
# Update mas formula in core (temporary)
cp -v "${LOCAL_MAS_FORMULA_PATH}" "${CORE_MAS_FORMULA_PATH}"
cp -v "${LOCAL_MAS_FORMULA_PATH}" "${CORE_MAS_FORMULA_FILE}"
# Install mas from source
# HOMEBREW_NO_INSTALL_FROM_API:
@ -127,7 +126,7 @@ popd
#
# echo "Checking to see if this update can be a simple bump."
# diff "${LOCAL_MAS_FORMULA_PATH}" "${CORE_MAS_FORMULA_PATH}"
# diff "${LOCAL_MAS_FORMULA_PATH}" "${CORE_MAS_FORMULA_FILE}"
echo "==> 🧪 Updating homebrew-core formula mas (${MAS_VERSION}, ${REVISION})"
@ -154,7 +153,7 @@ if [[ $dry_run == '-d' ]]; then
exit 0
fi
pushd "${CORE_FORMULA_PATH}"
pushd "${CORE_TAP_PATH}"
echo "Updating homebrew/core formula with a PR"

View file

@ -8,7 +8,7 @@
#
MAS_TAP_PATH="$(brew --repository mas-cli/tap)"
MAS_TAP_PATH_FORMULA="${MAS_TAP_PATH}/Formula/mas.rb"
MAS_TAP_FORMULA_FILE="${MAS_TAP_PATH}/Formula/mas.rb"
PROJECT_PATH="$(git rev-parse --show-toplevel)"
LOCAL_TAP_FORMULA_PATH="${PROJECT_PATH}/Homebrew/mas-tap.rb"
@ -65,31 +65,5 @@ fi
echo "REVISION: ${REVISION}"
################################################################################
#
# Create branch on mas-cli/homebrew-tap
#
# Ensure mas is tapped
if ! [[ -d "${MAS_TAP_PATH}" ]]; then
brew tap mas-cli/tap
fi
pushd "${MAS_TAP_PATH}"
branch_name="releases/release-${MAS_VERSION}"
$echo git branch "${branch_name}"
$echo git switch "${branch_name}"
# Update tap formula version
cp -v "${LOCAL_TAP_FORMULA_PATH}" "${MAS_TAP_PATH_FORMULA}"
$echo git add \
"${MAS_TAP_PATH_FORMULA}"
$echo git commit --message="🔖 Version ${MAS_VERSION}"
popd
# Build in mas project
script/bottle