From 0578f0c850b4e47fea6aa560bd08c864326454ee Mon Sep 17 00:00:00 2001 From: Ben Chatelain Date: Wed, 31 Jul 2024 21:04:54 -0600 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Pull=20tap=20git=20command?= =?UTF-8?q?s=20up=20into=20workflow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/release.yml | 35 +++++++++++++++++++++++------------ script/bottle | 20 +++++++++----------- script/brew_core_update | 9 ++++----- script/brew_tap_update | 28 +--------------------------- 4 files changed, 37 insertions(+), 55 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9b4b52a..db8d426 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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 }} diff --git a/script/bottle b/script/bottle index 8d65637..776cf20 100755 --- a/script/bottle +++ b/script/bottle @@ -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 diff --git a/script/brew_core_update b/script/brew_core_update index 468e225..c70c289 100755 --- a/script/brew_core_update +++ b/script/brew_core_update @@ -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" diff --git a/script/brew_tap_update b/script/brew_tap_update index 5f4da16..31b8c61 100755 --- a/script/brew_tap_update +++ b/script/brew_tap_update @@ -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