👷🏻‍♀️ Rework and rename prepare-release job

This commit is contained in:
Ben Chatelain 2024-07-30 17:53:50 -06:00
parent bc93e914f9
commit 97fa10f02c
No known key found for this signature in database
2 changed files with 30 additions and 17 deletions

View file

@ -29,17 +29,15 @@ jobs:
echo "DRY_RUN=false" >>$GITHUB_ENV echo "DRY_RUN=false" >>$GITHUB_ENV
echo "MAS_VERSION=${{ github.event.release.tag_name }}" >>${GITHUB_ENV} echo "MAS_VERSION=${{ github.event.release.tag_name }}" >>${GITHUB_ENV}
echo "RELEASE_BRANCH=releases/release-${{ MAS_VERSION }}" >>${GITHUB_ENV}
echo "RELEASE_COMMIT=${{ github.event.release.target_commitish }}" >>${GITHUB_ENV} echo "RELEASE_COMMIT=${{ github.event.release.target_commitish }}" >>${GITHUB_ENV}
- name: 🔈 Log environment variables - name: 🔈 Log environment variables
run: | run: |
echo "DRY_RUN: ${DRY_RUN}" echo "DRY_RUN: ${DRY_RUN}"
echo "MAS_VERSION: ${MAS_VERSION}" echo "MAS_VERSION: ${MAS_VERSION}"
echo "RELEASE_BRANCH: ${RELEASE_BRANCH}"
echo "RELEASE_COMMIT: ${RELEASE_COMMIT}" echo "RELEASE_COMMIT: ${RELEASE_COMMIT}"
version-update: prepare-release:
runs-on: macos-14 runs-on: macos-14
needs: [start] needs: [start]
steps: steps:
@ -48,24 +46,39 @@ jobs:
# A fetch-depth of 0 includes all history and tags for script/version # A fetch-depth of 0 includes all history and tags for script/version
fetch-depth: 0 fetch-depth: 0
- name: 🔖 version - name: 🔀 Create release branch
run: |
branch_name="releases/release-${MAS_VERSION}"
echo "RELEASE_BRANCH=${branch_name}" >>${GITHUB_ENV}
git branch "${branch_name}"
git switch "${branch_name}"
- name: 🔖 Update version
run: | run: |
script/version_bump "${MAS_VERSION}" "${RELEASE_COMMIT}" script/version_bump "${MAS_VERSION}" "${RELEASE_COMMIT}"
# branch_name="releases/release-${MAS_VERSION}" - name: 💾 Commit changes
# $echo git branch "${branch_name}" run: |
# $echo git switch "${branch_name}" git add \
"Homebrew/mas.rb" \
"Homebrew/mas-tap.rb" \
"Sources/MasKit/Package.swift"
git commit \
--message="🔖 Version ${MAS_VERSION}"
# $echo git add \ - name: ⤴️ Open PR
# "${SWIFT_PACKAGE}" \ env:
# "${LOCAL_MAS_FORMULA_PATH}" \ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# "${LOCAL_TAP_FORMULA_PATH}" run: |
gh pr create \
# $echo git commit --message="🔖 Version ${MAS_VERSION}" --base main \
--head "${RELEASE_BRANCH}" \
--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})."
pkg-installer: pkg-installer:
runs-on: macos-14 runs-on: macos-14
needs: [version-update] needs: [prepare-release]
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with: with:
@ -94,7 +107,7 @@ jobs:
homebrew-tap: homebrew-tap:
runs-on: macos-14 runs-on: macos-14
needs: [version-update] needs: [prepare-release]
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with: with:
@ -118,7 +131,7 @@ jobs:
homebrew-core: homebrew-core:
runs-on: macos-14 runs-on: macos-14
needs: [version-update, homebrew-tap] needs: [prepare-release, homebrew-tap]
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with: with:

View file

@ -7,9 +7,9 @@
# #
PROJECT_PATH="$(git rev-parse --show-toplevel)" PROJECT_PATH="$(git rev-parse --show-toplevel)"
SWIFT_PACKAGE="${PROJECT_PATH}/Sources/MasKit/Package.swift"
LOCAL_MAS_FORMULA_PATH="${PROJECT_PATH}/Homebrew/mas.rb" LOCAL_MAS_FORMULA_PATH="${PROJECT_PATH}/Homebrew/mas.rb"
LOCAL_TAP_FORMULA_PATH="${PROJECT_PATH}/Homebrew/mas-tap.rb" LOCAL_TAP_FORMULA_PATH="${PROJECT_PATH}/Homebrew/mas-tap.rb"
SWIFT_PACKAGE="${PROJECT_PATH}/Sources/MasKit/Package.swift"
function usage { function usage {
echo "Usage: version_bump v0.0 [sha1_hash]" echo "Usage: version_bump v0.0 [sha1_hash]"