Unfinished: Only bump formulae; don't generate them or store them in git.

Obtain version & revision from most recent version tag in the current branch, not from environment variable or argument.

Do not branch or commit on release.

Partial #638

Signed-off-by: Ross Goldberg <484615+rgoldberg@users.noreply.github.com>
This commit is contained in:
Ross Goldberg 2024-11-16 04:05:35 -05:00
parent f57c9054c4
commit 8306c6eb2c
No known key found for this signature in database
13 changed files with 41 additions and 469 deletions

View file

@ -17,7 +17,6 @@ jobs:
dry_run: ${{ steps.dry_run.outputs.dry_run }}
mas_version: ${{ steps.mas_version.outputs.mas_version }}
pre_release: ${{ steps.pre_release.outputs.pre_release }}
release_branch: ${{ steps.release_branch.outputs.release_branch }}
tap_path: ${{ steps.tap_path.outputs.tap_path }}
steps:
# Logs event details and sets `DRY_RUN` env var
@ -45,68 +44,19 @@ jobs:
run: |
echo "PRE_RELEASE=$(grep -q '-' <<<"${MAS_VERSION}" && echo 'true' || echo 'false')" >>"${GITHUB_OUTPUT}"
- id: release_branch
run: |
echo 'RELEASE_BRANCH=releases/release-${{ github.event.release.tag_name }}' >>"${GITHUB_OUTPUT}"
- id: tap_path
run: |
echo "TAP_PATH='$(brew --repo mas-cli/tap)'" >>"${GITHUB_OUTPUT}"
prepare-release:
runs-on: macos-15
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: 👢 Bootstrap
run: |
script/bootstrap -f
- name: 🔀 Create mas release branch
env:
RELEASE_BRANCH: ${{ needs.start.outputs.release_branch }}
run: |
git branch "${RELEASE_BRANCH}"
git switch "${RELEASE_BRANCH}"
- name: 🔖 Update version
env:
MAS_VERSION: ${{ needs.start.outputs.mas_version }}
run: |
script/generate_version_info_for_swift "${MAS_VERSION}"
- name: 🔧 Configure Git Author
run: |
git config --global user.name 'masclibot'
git config --global user.email 'masclibot@users.noreply.github.com'
- name: 💾 Commit changes
env:
MAS_VERSION: ${{ needs.start.outputs.mas_version }}
RELEASE_BRANCH: ${{ needs.start.outputs.release_branch }}
run: |
git add \
Homebrew/mas.rb \
Homebrew/mas-tap.rb \
Package.swift
git commit \
--message="🔖 Version ${MAS_VERSION}"
git push \
--set-upstream origin "${RELEASE_BRANCH}"
pkg-installer:
runs-on: macos-15
needs: [start, prepare-release]
needs: start
steps:
- uses: actions/checkout@v4
with:
# A fetch-depth of 0 includes all history and tags for script/version
fetch-depth: 0
ref: ${{ needs.start.outputs.release_branch }}
ref: ${{ needs.start.outputs.mas_version }}
- name: 👢 Bootstrap
run: |
@ -126,22 +76,21 @@ jobs:
env:
GH_TOKEN: ${{ github.token }}
DRY_RUN: ${{ needs.start.outputs.dry_run }}
MAS_VERSION: ${{ needs.start.outputs.mas_version }}
if: ${{ needs.start.outputs.dry_run == 'false' }}
run: |
gh release upload "${MAS_VERSION}" \
gh release upload '${{ needs.start.outputs.mas_version }}' \
.build/mas.pkg
homebrew-tap:
runs-on: macos-15
needs: [start, prepare-release]
needs: start
steps:
- name: 📺 Checkout mas repo
uses: actions/checkout@v4
with:
# A fetch-depth of 0 includes all history and tags for script/version
fetch-depth: 0
ref: ${{ needs.start.outputs.release_branch }}
ref: ${{ needs.start.outputs.mas_version }}
- name: 👢 Bootstrap
run: |
@ -179,60 +128,42 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.DEPLOY_TOKEN }}
DRY_RUN: ${{ needs.start.outputs.dry_run }}
RELEASE_BRANCH: ${{ needs.start.outputs.release_branch }}
MAS_VERSION: ${{ needs.start.outputs.mas_version }}
working-directory: ${{ needs.start.outputs.tap_path }}
run: |
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 \
--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})."
brew bump-formula-pr \
--strict \
--online \
--tag '${{ needs.start.outputs.mas_version }}' \
--revision "$(git rev-list -n 1 '${{ needs.start.outputs.mas_version }}')" \
mas-cli/tap/mas
- 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}"
script/bottle
- name: 🚀 Upload Bottles
env:
GH_TOKEN: ${{ github.token }}
DRY_RUN: ${{ needs.start.outputs.dry_run }}
MAS_VERSION: ${{ needs.start.outputs.mas_version }}
if: ${{ needs.start.outputs.dry_run == 'false' }}
run: |
gh release upload "${MAS_VERSION}" \
gh release upload '${{ needs.start.outputs.mas_version }}' \
.build/bottles/mas-*.bottle.tar.gz
homebrew-core:
runs-on: macos-15
needs: [start, prepare-release, homebrew-tap]
needs: [start, homebrew-tap]
if: ${{ needs.start.outputs.pre_release == 'false' }}
steps:
- uses: actions/checkout@v4
with:
# A fetch-depth of 0 includes all history and tags for script/version
fetch-depth: 0
ref: ${{ needs.start.outputs.release_branch }}
ref: ${{ needs.start.outputs.mas_version }}
- name: 👢 Bootstrap
run: |
@ -248,7 +179,5 @@ jobs:
GH_TOKEN: ${{ github.token }}
HOMEBREW_GITHUB_API_TOKEN: ${{ secrets.HOMEBREW_GITHUB_API_TOKEN }}
DRY_RUN: ${{ needs.start.outputs.dry_run }}
MAS_VERSION: ${{ needs.start.outputs.mas_version }}
run: |
DRY_RUN="${DRY_RUN}" \
script/brew_core_update "${MAS_VERSION}"
DRY_RUN="${DRY_RUN}" script/brew_core_update

View file

@ -1,7 +1,6 @@
brew "act"
brew "markdownlint-cli"
brew "prettier"
brew "sd"
brew "shellcheck"
brew "shfmt"
brew "swift-format"

View file

@ -40,55 +40,6 @@
}
}
},
"sd": {
"version": "1.0.0",
"bottle": {
"rebuild": 0,
"root_url": "https://ghcr.io/v2/homebrew/core",
"files": {
"arm64_sequoia": {
"cellar": ":any_skip_relocation",
"url": "https://ghcr.io/v2/homebrew/core/sd/blobs/sha256:3cf7ab4495f622a4f245bb1c7c30225ef881dc390ee5edc59a1d3c4381cecca1",
"sha256": "3cf7ab4495f622a4f245bb1c7c30225ef881dc390ee5edc59a1d3c4381cecca1"
},
"arm64_sonoma": {
"cellar": ":any_skip_relocation",
"url": "https://ghcr.io/v2/homebrew/core/sd/blobs/sha256:6bc773a70934364157591cd888e617601a42ed1f615fda8f77364fa45631d08d",
"sha256": "6bc773a70934364157591cd888e617601a42ed1f615fda8f77364fa45631d08d"
},
"arm64_ventura": {
"cellar": ":any_skip_relocation",
"url": "https://ghcr.io/v2/homebrew/core/sd/blobs/sha256:946a44f567e3528d380fbbee742c3abeed9952f53f7de172a846b63d2e21d5b1",
"sha256": "946a44f567e3528d380fbbee742c3abeed9952f53f7de172a846b63d2e21d5b1"
},
"arm64_monterey": {
"cellar": ":any_skip_relocation",
"url": "https://ghcr.io/v2/homebrew/core/sd/blobs/sha256:60f079d38aa238a1e7109c6a0f988fe7033449d20f05db3b87219cbfd945fe58",
"sha256": "60f079d38aa238a1e7109c6a0f988fe7033449d20f05db3b87219cbfd945fe58"
},
"sonoma": {
"cellar": ":any_skip_relocation",
"url": "https://ghcr.io/v2/homebrew/core/sd/blobs/sha256:f83ebe2505106e8c94c4b92d15c0ac3390dc637039043dbafad3e382fa8c61b0",
"sha256": "f83ebe2505106e8c94c4b92d15c0ac3390dc637039043dbafad3e382fa8c61b0"
},
"ventura": {
"cellar": ":any_skip_relocation",
"url": "https://ghcr.io/v2/homebrew/core/sd/blobs/sha256:0200b81c386198d39ed7b03e85c771e141d9604075d82aa4caed5d5a775486c8",
"sha256": "0200b81c386198d39ed7b03e85c771e141d9604075d82aa4caed5d5a775486c8"
},
"monterey": {
"cellar": ":any_skip_relocation",
"url": "https://ghcr.io/v2/homebrew/core/sd/blobs/sha256:a8fee9e7b0202a27d8dcc599ebd391637107134f139dbe88d6b22c880e63d8a1",
"sha256": "a8fee9e7b0202a27d8dcc599ebd391637107134f139dbe88d6b22c880e63d8a1"
},
"x86_64_linux": {
"cellar": ":any_skip_relocation",
"url": "https://ghcr.io/v2/homebrew/core/sd/blobs/sha256:4c098bdfaff013f7a6b6b96a65b9cfef86926e1cd901b363e1bdb84734ee6e3f",
"sha256": "4c098bdfaff013f7a6b6b96a65b9cfef86926e1cd901b363e1bdb84734ee6e3f"
}
}
}
},
"shellcheck": {
"version": "0.10.0",
"bottle": {

View file

@ -1,34 +0,0 @@
# typed: strict
# frozen_string_literal: true
# mas command formula for custom tap (mas-cli/homebrew-tap).
class Mas < Formula
desc "Mac App Store command-line interface"
homepage "https://github.com/mas-cli/mas"
url "https://github.com/mas-cli/mas.git",
tag: "v1.8.7-beta.1",
revision: "f8be3e9aaa6c78490277976f17041f2577f5dc21"
license "MIT"
head "https://github.com/mas-cli/mas.git", branch: "main"
bottle do
root_url "https://github.com/mas-cli/mas/releases/download/v1.8.7-beta.1"
sha256 cellar: :any_skip_relocation, el_capitan: "0d042a450d2623e3ea40db0b645454ee88d1a1763a7aa778eec5beea619b9a60"
end
depends_on xcode: ["14.2", :build]
depends_on :macos
def install
system "script/build"
system "script/install", prefix
bash_completion.install "contrib/completion/mas-completion.bash" => "mas"
fish_completion.install "contrib/completion/mas.fish"
end
test do
assert_equal version.to_s, shell_output("#{bin}/mas version").chomp
assert_includes shell_output("#{bin}/mas info 497799835"), "Xcode"
end
end

View file

@ -1,41 +0,0 @@
# typed: strict
# frozen_string_literal: true
# mas command formula for homebrew-core tap.
class Mas < Formula
desc "Mac App Store command-line interface"
homepage "https://github.com/mas-cli/mas"
url "https://github.com/mas-cli/mas.git",
tag: "v1.8.7-beta.1",
revision: "f8be3e9aaa6c78490277976f17041f2577f5dc21"
license "MIT"
head "https://github.com/mas-cli/mas.git", branch: "main"
bottle do
sha256 cellar: :any_skip_relocation, arm64_sonoma: "7b11bfefcb43e9a423ff301f7bbc29b0fb86044bf93442f243c5a8a67d8d4869"
sha256 cellar: :any_skip_relocation, arm64_ventura: "e49511dd1283813c4420aec9fc3b3167d18f9fdbb51d82b1e479b628d5312342"
sha256 cellar: :any_skip_relocation, arm64_monterey: "379d46e2657be295321f1603dc1df28130ea0b5b264ceb192a9ba488d77c7a98"
sha256 cellar: :any_skip_relocation, arm64_big_sur: "918a1484de106940f7bebc936e1ded87d7b65652054b09204887ad0651937ec4"
sha256 cellar: :any_skip_relocation, sonoma: "24e3057991ea1eed52eb4a27c0f17d794106770621e5a8bb975477dae135b82d"
sha256 cellar: :any_skip_relocation, ventura: "6ef7788e28c46cdc0f916812f49dfeb1fabf2240a8c36f33ce34bcfb9df1502f"
sha256 cellar: :any_skip_relocation, monterey: "6b313f2f66d028cb7782c108d6e502ce73ccb9c08fac3bece0b057fcce5c4689"
sha256 cellar: :any_skip_relocation, big_sur: "50b50f51219143fcb69c730b52b74011a76104f66348ea727d0200f7b375ae25"
sha256 cellar: :any_skip_relocation, catalina: "d241d3b9156b033f3d2c31684a44de726297e07fd9bd5e3ccc4c36e4f1c3baf3"
end
depends_on xcode: ["14.2", :build]
depends_on :macos
def install
system "script/build"
system "script/install", prefix
bash_completion.install "contrib/completion/mas-completion.bash" => "mas"
fish_completion.install "contrib/completion/mas.fish"
end
test do
assert_equal version.to_s, shell_output("#{bin}/mas version").chomp
assert_includes shell_output("#{bin}/mas info 497799835"), "Xcode"
end
end

View file

@ -76,33 +76,6 @@ if [[ "$(uname -m)" == 'arm64' ]]; then
CURRENT_PLATFORM="arm64_${CURRENT_PLATFORM}"
fi
################################################################################
#
# Preflight checks
#
# # 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
# Use formula from custom tap
# brew tap mas-cli/tap
# brew update
# Audit formula
brew audit --strict --verbose --formula --tap mas-cli/tap mas
brew style Homebrew/mas-tap.rb
################################################################################
#
# Build the formula for the current macOS version and architecture.
#
echo "==> 🍼 Bottling mas ${version} on ${CURRENT_PLATFORM} for ${OS_NAMES[*]}"
brew install --build-bottle mas-cli/tap/mas
@ -119,45 +92,10 @@ if [[ ! -e "${generated_bottle_filename}" ]]; then
exit 1
fi
SHA256="$(shasum -a 256 "${generated_bottle_filename}" | cut -f 1 -d ' ' -)"
mkdir -p "${BOTTLE_DIR}"
# Start of bottle block
BOTTLE_BLOCK="$(
cat <<-EOF
bottle do
root_url "${ROOT_URL}"
EOF
)"
################################################################################
#
# Copy the bottle for all macOS version + architecture combinations.
#
# Fix filename
for os in "${OS_NAMES[@]}"; do
cp -v "${generated_bottle_filename}" "${BOTTLE_DIR}/mas-${version}.${os}.bottle.tar.gz"
# Append each os
# BOTTLE_BLOCK="$(printf "${BOTTLE_BLOCK}\n sha256 cellar: :any_skip_relocation, %-15s %s" "${os}:" "${SHA256}")"
BOTTLE_BLOCK="${BOTTLE_BLOCK}$(
cat <<-EOF
sha256 cellar: :any_skip_relocation, ${os}: "${SHA256}"
EOF
)"
done
# End of bottle block
BOTTLE_BLOCK="$(
cat <<-EOF
end
EOF
)"
rm "${generated_bottle_filename}"
ls -l "${BOTTLE_DIR}"
echo "${BOTTLE_BLOCK}"

View file

@ -16,18 +16,14 @@ if ! cd -- "${mas_dir}"; then
exit 1
fi
CORE_TAP_PATH="$(brew --repo homebrew/core)"
function usage {
echo 'Usage: brew_core_update [-d] [<version_tag> [<sha1_hash>]]' >&2
echo 'Usage: brew_core_update [-d]' >&2
echo ' -d option enables dry run mode' >&2
echo ' version will be inferred using version script if not provided' >&2
echo ' sha will be inferred from the current commit if not provided' >&2
exit 1
}
# Max 3 arguments
if [[ "${#}" -gt 3 ]]; then
# Max 1 argument
if [[ "${#}" -gt 1 ]]; then
usage
fi
@ -37,7 +33,7 @@ dry_run=
while getopts 'd' o; do
case "${o}" in
d)
dry_run=-d
dry_run=--dry-run
;;
*)
usage
@ -49,106 +45,21 @@ shift "$((OPTIND - 1))"
# DRY_RUN environment variable
# shellcheck disable=SC2153
if [[ "${DRY_RUN}" == 'true' ]]; then
dry_run=-d
dry_run=--dry-run
fi
# arg 1 - version tag
MAS_VERSION="${1:-"v$(script/version)"}"
version_tag="v$(script/version)"
revision="$(git rev-parse "${version_tag}")"
echo "MAS_VERSION: ${MAS_VERSION}"
# arg 2 - revision (commit hash)
# If arg 2 wasn't supplied or is empty, obtain revision from ${MAS_VERSION} version tag
REVISION="${2:-"$(git rev-parse "${MAS_VERSION}")"}"
echo "REVISION: ${REVISION}"
################################################################################
#
# Preflight checks
#
# 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
# Ensure core is tapped
if ! [[ -d "${CORE_TAP_PATH}" ]]; then
brew tap homebrew/core
fi
brew update
################################################################################
#
# Build the formula for the current macOS version and architecture.
#
# Update mas formula in core (temporary)
cp -v Homebrew/mas.rb "${CORE_TAP_PATH}/Formula/m/mas.rb"
# Install mas from source
# HOMEBREW_NO_INSTALL_FROM_API:
# Force brew to use the local repository instead of the API.
# Disable API before any install, reinstall or upgrade commands.
HOMEBREW_NO_INSTALL_FROM_API=1 \
brew install mas \
--build-from-source \
--verbose
# Audit formula
brew audit --strict mas
brew style mas
# Revert core formula change after testing
pushd "${CORE_TAP_PATH}"
git diff
git checkout .
popd
################################################################################
#
# Update Homebrew
#
echo "==> 🧪 Updating homebrew-core formula mas (${MAS_VERSION}, ${REVISION})"
echo 'Validating formula'
brew bump-formula-pr \
--tag="${MAS_VERSION}" \
--revision="${REVISION}" \
--strict \
--verbose \
--no-browse \
--fork-org mas-cli \
--dry-run \
mas
# brew exit status
status="${?}"
if [[ "${status}" -ne 0 ]]; then
echo $'Formula did not validate using \'brew bump-formula-pr\'' >&2
exit "${status}"
fi
if [[ "${dry_run}" == '-d' ]]; then
exit 0
fi
echo 'Updating homebrew/core formula with a PR'
echo "==> 🧪 Updating mas homebrew-core formula to version tag ${version_tag} @ revision ${revision}"
brew bump-formula-pr \
--tag="${MAS_VERSION}" \
--revision="${REVISION}" \
--tag="${version_tag}" \
--revision="${revision}" \
--strict \
--verbose \
--online \
--no-browse \
--fork-org mas-cli \
${dry_run} \
mas

View file

@ -1,41 +0,0 @@
#!/bin/bash -ex
#
# script/brew_tap_update
# mas
#
# Updates mas custom tap formula:
# https://github.com/mas-cli/homebrew-tap/blob/main/Formula/mas.rb
#
mas_dir="$(readlink -fn "$(dirname "${BASH_SOURCE:-"${0}"}")/..")"
if ! cd -- "${mas_dir}"; then
printf $'Error: Could not cd into mas directory: %s\n' "${mas_dir}" >&2
exit 1
fi
function usage {
echo 'Usage: brew_tap_update [<version_tag> [<sha1_hash>]]' >&2
echo ' version will be inferred using version script if not provided' >&2
echo ' sha will be inferred from the current commit if not provided' >&2
exit 1
}
# Max 2 arguments
if [[ "${#}" -gt 2 ]]; then
usage
fi
# arg 1 - version tag
MAS_VERSION="${1:-"v$(script/version)"}"
echo "MAS_VERSION: ${MAS_VERSION}"
# arg 2 - revision (commit hash)
# If arg 2 wasn't supplied or is empty, obtain revision from ${MAS_VERSION} version tag
REVISION="${2:-"$(git rev-parse "${MAS_VERSION}")"}"
echo "REVISION: ${REVISION}"
# Build in mas project
script/bottle

View file

@ -30,7 +30,9 @@ else
CACHE=()
fi
echo "==> 🏗️ Building mas $(script/version --write)"
script/generate_version_info_for_swift
echo "==> 🏗️ Building mas $(script/version)"
swift build \
--configuration release \
"${ARCH[@]+"${ARCH[@]}"}" \

View file

@ -3,7 +3,7 @@
# script/generate_version_info_for_swift
# mas
#
# Increments the marketing version of mas.
# Generates a file to provide the mas version to Swift code.
#
mas_dir="$(readlink -fn "$(dirname "${BASH_SOURCE:-"${0}"}")/..")"
@ -13,46 +13,10 @@ if ! cd -- "${mas_dir}"; then
exit 1
fi
LOCAL_MAS_FORMULA_PATH=Homebrew/mas.rb
LOCAL_TAP_FORMULA_PATH=Homebrew/mas-tap.rb
SWIFT_PACKAGE=Sources/mas/Package.swift
function usage {
echo 'Usage: generate_version_info_for_swift <version_tag> [<sha1_hash>]' >&2
echo ' existing tag name' >&2
echo ' sha will be inferred from the given tag if not provided' >&2
exit 1
}
if [[ "${#}" -lt 1 ]]; then
usage
fi
# arg 1 - version tag
MAS_VERSION="${1}"
# arg 2 - revision (commit hash)
# If arg 2 wasn't supplied or is empty, obtain revision from ${MAS_VERSION} version tag
REVISION="${2:-"$(git rev-parse "${MAS_VERSION}")"}"
echo "MAS_VERSION: ${MAS_VERSION}"
echo "REVISION: ${REVISION}"
# Write new version into swift package
cat <<EOF >"${SWIFT_PACKAGE}"
# Write version to Swift singleton
cat <<EOF >Sources/mas/Package.swift
/// Generated by \`script/generate_version_info_for_swift\`.
enum Package {
static let version = "${MAS_VERSION#v}"
static let version = "$(script/version)"
}
EOF
echo
cat "${SWIFT_PACKAGE}"
# Write new version into brew formulae
for file in "${LOCAL_MAS_FORMULA_PATH}" "${LOCAL_TAP_FORMULA_PATH}"; do
echo "${file}"
sd '( +tag: +)"[^"]+"' "\$1\"${MAS_VERSION}\"" "${file}"
sd '( +revision: +)"[^"]+"' "\$1\"${REVISION}\"" "${file}"
sd '( +root_url "https://github.com/mas-cli/mas/releases/download/).+' "\${1}${MAS_VERSION}\"" "${file}"
done

View file

@ -19,7 +19,9 @@ if ! cd -- "${mas_dir}"; then
exit 1
fi
printf $'==> 🚨 Linting mas %s\n' "$(script/version --write)"
script/generate_version_info_for_swift
printf $'==> 🚨 Linting mas %s\n' "$(script/version)"
for linter in git markdownlint periphery shellcheck shfmt swift-format swiftformat swiftlint yamllint; do
if [[ ! -x "$(command -v "${linter}")" ]]; then

View file

@ -13,6 +13,8 @@ if ! cd -- "${mas_dir}"; then
exit 1
fi
printf $'==> ✅ Testing mas %s\n' "$(script/version --write)"
script/generate_version_info_for_swift
printf $'==> ✅ Testing mas %s\n' "$(script/version)"
swift test

View file

@ -3,7 +3,7 @@
# script/version
# mas
#
# Displays the current marketing version of mas.
# Displays the mas version.
#
mas_dir="$(readlink -fn "$(dirname "${BASH_SOURCE:-"${0}"}")/..")"
@ -15,13 +15,3 @@ fi
version_tag="$(git describe --abbrev=0 --tags 2>/dev/null)"
printf $'%s\n' "${version_tag#v}"
if [[ "${#}" -ge 1 && "${1}" == '--write' ]]; then
# Write new version into swift package
cat <<EOF >Sources/mas/Package.swift
/// Generated by \`script/version\`.
enum Package {
static let version = "${MAS_VERSION#v}"
}
EOF
fi