Skip to content

Commit

Permalink
πŸ‘·πŸΌβ€β™‚οΈ Add version-update job to release workflow
Browse files Browse the repository at this point in the history
Need to call version_bump before both homebrew jobs
  • Loading branch information
phatblat committed Jul 30, 2024
1 parent 78757ab commit 76d380d
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 26 deletions.
30 changes: 27 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,33 @@ jobs:
echo "MAS_VERSION: ${MAS_VERSION}"
echo "RELEASE_COMMIT: ${RELEASE_COMMIT}"
version-update:
runs-on: macos-14
needs: [start]
steps:
- uses: actions/checkout@v4
with:
# A fetch-depth of 0 includes all history and tags for script/version
fetch-depth: 0

- name: πŸ”– version
run: |
script/version_bump "${MAS_VERSION}" "${RELEASE_COMMIT}"
# branch_name="releases/release-${MAS_VERSION}"
# $echo git branch "${branch_name}"
# $echo git switch "${branch_name}"

# $echo git add \
# "${SWIFT_PACKAGE}" \
# "${LOCAL_MAS_FORMULA_PATH}" \
# "${LOCAL_TAP_FORMULA_PATH}"

# $echo git commit --message="πŸ”– Version ${MAS_VERSION}"

pkg-installer:
runs-on: macos-14
needs: start
needs: [version-update]
steps:
- uses: actions/checkout@v4
with:
Expand Down Expand Up @@ -68,7 +92,7 @@ jobs:
homebrew-tap:
runs-on: macos-14
needs: [start]
needs: [version-update]
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -92,7 +116,7 @@ jobs:
homebrew-core:
runs-on: macos-14
needs: [start, homebrew-tap]
needs: [version-update, homebrew-tap]
steps:
- uses: actions/checkout@v4
with:
Expand Down
20 changes: 0 additions & 20 deletions script/brew_core_update
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ CORE_FORMULA_PATH="${CORE_TAP_PATH}/Formula/"
CORE_MAS_FORMULA_PATH="${CORE_FORMULA_PATH}/m/mas.rb"

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_TAP_FORMULA_PATH="${PROJECT_PATH}/Homebrew/mas-tap.rb"

function usage {
echo "Usage: brew_core_update [-d] v0.0 [sha1_hash]"
Expand Down Expand Up @@ -74,24 +72,6 @@ fi

echo "REVISION: ${REVISION}"

################################################################################
#
# Update Version
#

script/version_bump "${MAS_VERSION}" "${REVISION}"

branch_name="releases/release-${MAS_VERSION}"
$echo git branch "${branch_name}"
$echo git switch "${branch_name}"

$echo git add \
"${SWIFT_PACKAGE}" \
"${LOCAL_MAS_FORMULA_PATH}" \
"${LOCAL_TAP_FORMULA_PATH}"

$echo git commit --message="πŸ”– Version ${MAS_VERSION}"

################################################################################
#
# Preflight checks
Expand Down
6 changes: 3 additions & 3 deletions script/version_bump
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#

PROJECT_PATH="$(git rev-parse --show-toplevel)"
PACKAGE_MANIFEST="${PROJECT_PATH}/Sources/MasKit/Package.swift"
SWIFT_PACKAGE="${PROJECT_PATH}/Sources/MasKit/Package.swift"
LOCAL_MAS_FORMULA_PATH="${PROJECT_PATH}/Homebrew/mas.rb"
LOCAL_TAP_FORMULA_PATH="${PROJECT_PATH}/Homebrew/mas-tap.rb"

Expand Down Expand Up @@ -38,15 +38,15 @@ echo "MAS_VERSION: ${MAS_VERSION}"
echo "REVISION: ${REVISION}"

# Write new version into swift package
cat <<EOF >"${PACKAGE_MANIFEST}"
cat <<EOF >"${SWIFT_PACKAGE}"
// Generated by: script/version
enum Package {
static let version = "${MAS_VERSION#v}"
}
EOF

echo
cat "${PACKAGE_MANIFEST}"
cat "${SWIFT_PACKAGE}"

# Write new version into brew formulae
for file in ${LOCAL_MAS_FORMULA_PATH} ${LOCAL_TAP_FORMULA_PATH}; do
Expand Down

0 comments on commit 76d380d

Please sign in to comment.