Merge pull request #506 from mas-cli/releases/release-1.8.7

🔖 Release 1.8.7
This commit is contained in:
Ross Goldberg 2024-11-15 11:08:36 -05:00 committed by GitHub
commit ca921c07d8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
37 changed files with 1100 additions and 434 deletions

8
.actrc Normal file
View file

@ -0,0 +1,8 @@
--action-offline-mode
--eventpath .github/event.json
--container-architecture linux/amd64
--log-prefix-job-id
--platform macos-15=-self-hosted
--pull=false
--reuse
--secret-file .secrets

View file

@ -27,6 +27,7 @@ indent_style = tab
# JSON files contain newlines inconsistently
[*.json]
indent_size = 2
insert_final_newline = ignore
# Makefiles always use tabs for indentation

View file

@ -1,4 +1,5 @@
# https://docs.github.com/en/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/configuration-options-for-dependency-updates
---
version: 2
updates:
- package-ecosystem: "github-actions"

12
.github/event.json vendored Normal file
View file

@ -0,0 +1,12 @@
{
"inputs": {
"NAME": "Manual Workflow",
"SOME_VALUE": "ABC"
},
"release": {
"name": "v1.8.6-beta.1: macOS only test build",
"tag_name": "v1.8.7-beta.1",
"target_commitish": "f8be3e9aaa6c78490277976f17041f2577f5dc21",
"body": "This is a pre-release to facilitate testing for the following fix:\n\n - 🖥️ Only search, outdated and update macOS apps (#505, #496, #491, #336)"
}
}

11
.github/release.yml vendored
View file

@ -1,12 +1,13 @@
# https://docs.github.com/en/repositories/releasing-projects-on-github/automatically-generated-release-notes
---
changelog:
categories:
- title: '🚀 Features'
- title: "🚀 Features"
labels:
- '🆕 feature request'
- title: '🐛 Bug Fixes'
- "🆕 feature request"
- title: "🐛 Bug Fixes"
labels:
- '🐛 bug'
- "🐛 bug"
- title: Changes
labels:
- '*'
- "*"

View file

@ -2,14 +2,14 @@
# .github/workflows/build-test.yml
#
# https://docs.github.com/en/actions/reference/environment-variables#default-environment-variables
---
name: Build, Test, and Lint
on:
push:
branches: [ main ]
pull_request:
branches: [main]
push:
branches: [main]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
@ -17,6 +17,10 @@ concurrency:
jobs:
build-test:
name: Build, Test, and Lint
# https://github.com/actions/runner-images#available-images
runs-on: macos-15
defaults:
run:
@ -26,22 +30,14 @@ jobs:
# https://github.com/actions/virtual-environments/issues/2187#issuecomment-790507204
shell: arch -arm64 bash --noprofile --norc -eo pipefail {0}
name: Build, Test, and Lint
# https://github.blog/changelog/2024-01-30-github-actions-introducing-the-new-m1-macos-runner-available-to-open-source
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners
# https://github.com/mas-cli/mas/actions/runners
runs-on: macos-15
steps:
# https://github.com/actions/checkout#usage
- 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
run: script/bootstrap -f
- name: Build
run: script/build

View file

@ -1,16 +1,20 @@
name: Danger
#
# .github/workflows/danger.yml
#
# https://docs.github.com/en/actions/reference/environment-variables#default-environment-variables
---
name: danger
on:
pull_request:
branches: [main]
jobs:
danger:
name: Danger
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Danger
# https://github.com/orgs/danger/packages/container/package/danger-swift
uses: docker://ghcr.io/danger/danger-swift:3.12.3
uses: docker://ghcr.io/danger/danger-swift:3.18.0
with:
args: --failOnErrors --no-publish-check
env:

254
.github/workflows/release.yml vendored Normal file
View file

@ -0,0 +1,254 @@
#
# .github/workflows/release.yml
#
---
name: release
defaults:
run:
# Prefixes all `run` commands with the following command to force them to run outside Rosetta.
shell: arch -arm64 bash --noprofile --norc -eo pipefail {0}
on:
release:
types: [published]
jobs:
start:
runs-on: macos-15
outputs:
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 }}
steps:
# Logs event details and sets `DRY_RUN` env var
# https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-an-environment-variable
# https://docs.github.com/en/webhooks/webhook-events-and-payloads?actionType=published#release
- name: 🔈 Log release event
# This step will only run for a real 'release' event.
if: ${{ github.event.release.name != '' }}
run: |
echo "Triggered by a release publication event (wet run)"
echo "release.name: ${{ github.event.release.name }}"
echo "release.tag_name: ${{ github.event.release.tag_name }}"
echo "release.target_commitish: ${{ github.event.release.target_commitish }}"
echo -e "release.body: \n${{ github.event.release.body }}"
- id: dry_run
run: |
echo "DRY_RUN=false" >>"$GITHUB_OUTPUT"
- id: mas_version
run: |
echo "MAS_VERSION=${{ github.event.release.tag_name }}" >>"$GITHUB_OUTPUT"
- id: pre_release
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"
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/version_bump "${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]
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 }}
- name: 👢 Bootstrap
run: |
script/bootstrap -f
# Important to trigger a universal build first as package just works with
# the `mas` binary in finds in the build dir.
- name: 🏗️ Build Universal
run: |
script/build --universal
- name: 📦 macOS Package
run: |
script/package
- name: 🚀 Upload mas.pkg
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} \
.build/mas.pkg
homebrew-tap:
runs-on: macos-15
needs: [start, prepare-release]
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 }}
- name: 👢 Bootstrap
run: |
script/bootstrap -f
# The mas-cli/homebrew-tap repo needs to be checked out using the current
# GitHub credentials in order to open a PR. However, the `brew tap` command
# must be run for Homebrew to see the dir as a tap.
# This is necessary to avoid the following error:
# Error: No available formula or cask with the name "mas-cli/tap/mas".
- name: 🚰 Checkout mas tap
run: |
rm -rf /opt/homebrew/Library/Taps
mkdir Taps
ln -s $(realpath Taps) /opt/homebrew/Library/Taps
ls -l /opt/homebrew/Library/Taps
brew tap mas-cli/tap
brew tap
# Checkout with a token for write access
- name: 🚰 Re-clone mas tap
uses: actions/checkout@v4
with:
repository: mas-cli/homebrew-tap
token: ${{ secrets.DEPLOY_TOKEN }}
# brew --repository mas-cli/tap
path: Taps/mas-cli/homebrew-tap
- name: 🔧 Configure Git Author
run: |
git config --global user.name 'masclibot'
git config --global user.email 'masclibot@users.noreply.github.com'
- name: ⤴️ Open mas tap PR
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: /opt/homebrew/Library/Taps/mas-cli/homebrew-tap
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})."
- 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 }}
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} \
.build/bottles/mas-*.bottle.tar.gz
homebrew-core:
runs-on: macos-15
needs: [start, prepare-release, homebrew-tap]
env:
PRE_RELEASE: ${{ needs.start.outputs.pre_release }}
steps:
- uses: actions/checkout@v4
if: env.PRE_RELEASE == 'false'
with:
# A fetch-depth of 0 includes all history and tags for script/version
fetch-depth: 0
ref: ${{ needs.start.outputs.release_branch }}
- name: 👢 Bootstrap
if: env.PRE_RELEASE == 'false'
run: |
script/bootstrap -f
- name: 🔧 Configure Git Author
if: env.PRE_RELEASE == 'false'
run: |
git config --global user.name 'masclibot'
git config --global user.email 'masclibot@users.noreply.github.com'
- name: 🍺 Update Homebrew mas formula
env:
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 }}
if: env.PRE_RELEASE == 'false'
run: |
DRY_RUN=${DRY_RUN} \
script/brew_core_update ${MAS_VERSION}

7
.gitignore vendored
View file

@ -27,15 +27,18 @@
.fseventsd
.idea/
.rubygems/
.secrets
.swiftpm/
.vscode/
Carthage/
DerivedData
Pods/
Sources/mas/Package.swift
Sources/MasKit/Package.swift
Temporary Items
bin/
build/
default.profraw
gha/
releases/
xcuserdata
Sources/mas/Package.swift
Sources/MasKit/Package.swift

11
.mise.toml Normal file
View file

@ -0,0 +1,11 @@
#
# .mise.toml
# https://mise.jdx.dev/configuration.html
#
[tools]
act = "0.2.60"
"npm:prettier" = "3.2.5"
[settings]
experimental = true

View file

@ -1,2 +1,3 @@
---
retain_public: true
strict: true

View file

@ -1,49 +0,0 @@
#
# .travis.yml
# mas-cli
#
# https://travis-ci.com/mas-cli/mas
# https://docs.travis-ci.com/user/reference/osx/
# https://docs.travis-ci.com/user/languages/objective-c/
#
# https://docs.travis-ci.com/user/build-config-validation
version: ~> 1.0
# https://docs.travis-ci.com/user/reference/osx/#macos-version
os: osx
osx_image: xcode11.5 # macOS 10.15.4
env:
global:
- LANG=en_US.UTF-8
- LC_ALL=en_US.UTF-8
- LANGUAGE=en_US.UTF-8
# Bundler 2
# https://docs.travis-ci.com/user/languages/ruby/#bundler-20
before_install:
- gem install bundler
install:
- script/bootstrap
script:
- script/build
- script/test
- bundle exec danger
before_deploy:
- script/package
deploy:
provider: releases
api_key:
secure: SEAdxkLeRJ/z7cO4Y//8sxrYbNlzz3W4ip717gcMsuxp6LzsQtS7QW+/N3iSNuowgIKqTad0ZdiYHczwa+mTI/rjPDP1mxC4Bx+pQpZN+bizY9MNVcDDTSD6yCvI1vZl+dLQwUKKzW/lTKDk4yunOmxLV4xtDE7EDfyf1Zkypx0mQ6SoG2cFHZVDrDrU4c05oPtD/3dTvq2lVf5suBhjrRNLSOpIU4fPgc3PbPCL1MtIZRQpGfVPGWZLRMOHLXNIKFkP1qaa6Z2+R1iZjtqZ5isECikRNSPeBYm7OWx/EoGqRbC64YVIjTKi17rjEHDf46RxskPKa4Df6i2X4HCzhZBKcVB/Zu4HpjaR8gMcTCT0QnfHpDDgyAMVBPW84uyhfJ93GJaK7vk5NebY6IWg4d/mrisZ5XA4o6EXZSOSTbrZEZDn+2Knp9IIad169YYymo6ESr4zFwfxXG516ozYi8ROuWP0ZR+wxgBkm3b2mvryABgye45k/yqX/8Pd7RD/wB03RTOKkog4gQkyhrR9VSpuSVXfAm89Qg4Y+nzdDNoSR8i9xKN/c+rXFMnmuTItwiIqE30Nb58dISt2BEpFzDRh00ae1kOZ3coC0WsqW7hmdk46QvhhEOIYGVYOlUDU/8BownV37alfAiiQV0tjEwX7YMV+6qwraKmdnjOWISk=
file:
- mas-cli.zip
- mas.xcarchive.zip
skip_cleanup: true
on:
repo: mas-cli/mas
tags: true

17
.yamllint.yml Normal file
View file

@ -0,0 +1,17 @@
# https://yamllint.readthedocs.io/en/stable/configuration.html#default-configuration
---
extends: default
locale: en_US.UTF-8
ignore-from-file: .gitignore
rules:
line-length:
max: 120
level: warning
# https://yamllint.readthedocs.io/en/stable/rules.html#module-yamllint.rules.truthy
truthy:
allowed-values: ["true", "false"]
check-keys: false
# Disables fallse positives on GHA workflow `on:`
level: warning

View file

@ -1,9 +1,12 @@
brew "markdownlint-cli"
brew "mise"
brew "sd"
brew "shellcheck"
brew "shfmt"
brew "swift-format"
brew "swiftformat"
brew "trash"
brew "yamllint"
if OS.mac? && MacOS.version >= :ventura
brew "swiftlint"

View file

@ -40,6 +40,94 @@
}
}
},
"mise": {
"version": "2024.10.11",
"bottle": {
"rebuild": 0,
"root_url": "https://ghcr.io/v2/homebrew/core",
"files": {
"arm64_sequoia": {
"cellar": ":any",
"url": "https://ghcr.io/v2/homebrew/core/mise/blobs/sha256:3d1ce9664736b5039466ceeb8286f87150a220d76cf62e5c5538ed4c42c01ff0",
"sha256": "3d1ce9664736b5039466ceeb8286f87150a220d76cf62e5c5538ed4c42c01ff0"
},
"arm64_sonoma": {
"cellar": ":any",
"url": "https://ghcr.io/v2/homebrew/core/mise/blobs/sha256:d28afbc2017aa2d5904da9ca14e1fc9d01d341bfd0adc5168ace961e326b5b1c",
"sha256": "d28afbc2017aa2d5904da9ca14e1fc9d01d341bfd0adc5168ace961e326b5b1c"
},
"arm64_ventura": {
"cellar": ":any",
"url": "https://ghcr.io/v2/homebrew/core/mise/blobs/sha256:c4005d63d073861cef944841aa88925b1b929bc150d94bebe65322a4c7a6886f",
"sha256": "c4005d63d073861cef944841aa88925b1b929bc150d94bebe65322a4c7a6886f"
},
"sonoma": {
"cellar": ":any",
"url": "https://ghcr.io/v2/homebrew/core/mise/blobs/sha256:d392eae34949295556f9c3598ce97bf44f5392b996b02ea31956169332a41f1c",
"sha256": "d392eae34949295556f9c3598ce97bf44f5392b996b02ea31956169332a41f1c"
},
"ventura": {
"cellar": ":any",
"url": "https://ghcr.io/v2/homebrew/core/mise/blobs/sha256:fd1afe999715d971c78f4bfa90b74fae7b7f8688477b07ea89c67ee36ea8463a",
"sha256": "fd1afe999715d971c78f4bfa90b74fae7b7f8688477b07ea89c67ee36ea8463a"
},
"x86_64_linux": {
"cellar": ":any_skip_relocation",
"url": "https://ghcr.io/v2/homebrew/core/mise/blobs/sha256:22601cf4faf8764cf29d6cea72ef0e0789b10da581d899a229aace4e0069b2c4",
"sha256": "22601cf4faf8764cf29d6cea72ef0e0789b10da581d899a229aace4e0069b2c4"
}
}
}
},
"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": {
@ -90,50 +178,40 @@
}
},
"shfmt": {
"version": "3.9.0",
"version": "3.10.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/shfmt/blobs/sha256:6b2151cc6266a7c0a21a6ec4edab774168671d81406bd127980dd5b5ebdad9d9",
"sha256": "6b2151cc6266a7c0a21a6ec4edab774168671d81406bd127980dd5b5ebdad9d9"
"url": "https://ghcr.io/v2/homebrew/core/shfmt/blobs/sha256:88d60bca61406671618ecf94f2d81104882f9dd8db838a70d0c2cd6c0fa46863",
"sha256": "88d60bca61406671618ecf94f2d81104882f9dd8db838a70d0c2cd6c0fa46863"
},
"arm64_sonoma": {
"cellar": ":any_skip_relocation",
"url": "https://ghcr.io/v2/homebrew/core/shfmt/blobs/sha256:d15598743aa7c7688b49b4a0df839805f605faaa692def2f36554c26e5136eeb",
"sha256": "d15598743aa7c7688b49b4a0df839805f605faaa692def2f36554c26e5136eeb"
"url": "https://ghcr.io/v2/homebrew/core/shfmt/blobs/sha256:88d60bca61406671618ecf94f2d81104882f9dd8db838a70d0c2cd6c0fa46863",
"sha256": "88d60bca61406671618ecf94f2d81104882f9dd8db838a70d0c2cd6c0fa46863"
},
"arm64_ventura": {
"cellar": ":any_skip_relocation",
"url": "https://ghcr.io/v2/homebrew/core/shfmt/blobs/sha256:d15598743aa7c7688b49b4a0df839805f605faaa692def2f36554c26e5136eeb",
"sha256": "d15598743aa7c7688b49b4a0df839805f605faaa692def2f36554c26e5136eeb"
},
"arm64_monterey": {
"cellar": ":any_skip_relocation",
"url": "https://ghcr.io/v2/homebrew/core/shfmt/blobs/sha256:d15598743aa7c7688b49b4a0df839805f605faaa692def2f36554c26e5136eeb",
"sha256": "d15598743aa7c7688b49b4a0df839805f605faaa692def2f36554c26e5136eeb"
"url": "https://ghcr.io/v2/homebrew/core/shfmt/blobs/sha256:88d60bca61406671618ecf94f2d81104882f9dd8db838a70d0c2cd6c0fa46863",
"sha256": "88d60bca61406671618ecf94f2d81104882f9dd8db838a70d0c2cd6c0fa46863"
},
"sonoma": {
"cellar": ":any_skip_relocation",
"url": "https://ghcr.io/v2/homebrew/core/shfmt/blobs/sha256:70107f7fdf986b706bc63652fd16355f426c7789088bfd5beb0fe83fc5069fe7",
"sha256": "70107f7fdf986b706bc63652fd16355f426c7789088bfd5beb0fe83fc5069fe7"
"url": "https://ghcr.io/v2/homebrew/core/shfmt/blobs/sha256:788b7ecff02bbff7fa1563a4937999972799361b4a0c49b1ed8545983d6ff989",
"sha256": "788b7ecff02bbff7fa1563a4937999972799361b4a0c49b1ed8545983d6ff989"
},
"ventura": {
"cellar": ":any_skip_relocation",
"url": "https://ghcr.io/v2/homebrew/core/shfmt/blobs/sha256:70107f7fdf986b706bc63652fd16355f426c7789088bfd5beb0fe83fc5069fe7",
"sha256": "70107f7fdf986b706bc63652fd16355f426c7789088bfd5beb0fe83fc5069fe7"
},
"monterey": {
"cellar": ":any_skip_relocation",
"url": "https://ghcr.io/v2/homebrew/core/shfmt/blobs/sha256:70107f7fdf986b706bc63652fd16355f426c7789088bfd5beb0fe83fc5069fe7",
"sha256": "70107f7fdf986b706bc63652fd16355f426c7789088bfd5beb0fe83fc5069fe7"
"url": "https://ghcr.io/v2/homebrew/core/shfmt/blobs/sha256:788b7ecff02bbff7fa1563a4937999972799361b4a0c49b1ed8545983d6ff989",
"sha256": "788b7ecff02bbff7fa1563a4937999972799361b4a0c49b1ed8545983d6ff989"
},
"x86_64_linux": {
"cellar": ":any_skip_relocation",
"url": "https://ghcr.io/v2/homebrew/core/shfmt/blobs/sha256:6f9f1e653f63d0d4c9042b9dca3063074326998b19b5b216478b682bd437ee17",
"sha256": "6f9f1e653f63d0d4c9042b9dca3063074326998b19b5b216478b682bd437ee17"
"url": "https://ghcr.io/v2/homebrew/core/shfmt/blobs/sha256:0b15af30edec238edf607c38a95bd45249cdd6f48f30ab33bdd0a9c2ae2da956",
"sha256": "0b15af30edec238edf607c38a95bd45249cdd6f48f30ab33bdd0a9c2ae2da956"
}
}
}
@ -146,72 +224,72 @@
"files": {
"arm64_sequoia": {
"cellar": ":any_skip_relocation",
"url": "https://ghcr.io/v2/homebrew/core/swift-format/blobs/sha256:87797001883127b2279ca6c852090fd1fe2e268ada680161c1b2d86be113191e",
"sha256": "87797001883127b2279ca6c852090fd1fe2e268ada680161c1b2d86be113191e"
"url": "https://ghcr.io/v2/homebrew/core/swift-format/blobs/sha256:4bee0106201ba2a3036576610e61832b97fb65292c194f52fc15d62e1bdb2243",
"sha256": "4bee0106201ba2a3036576610e61832b97fb65292c194f52fc15d62e1bdb2243"
},
"arm64_sonoma": {
"cellar": ":any_skip_relocation",
"url": "https://ghcr.io/v2/homebrew/core/swift-format/blobs/sha256:38473895d6a806d2ebef3634f0a0f7fe9b10c733a6e538a33d2cd0bbead6bccd",
"sha256": "38473895d6a806d2ebef3634f0a0f7fe9b10c733a6e538a33d2cd0bbead6bccd"
"url": "https://ghcr.io/v2/homebrew/core/swift-format/blobs/sha256:ac50e5269ecc0bffb70a6c5077f97954e2e51c9158a3bfa36b86d89f9d6c5e43",
"sha256": "ac50e5269ecc0bffb70a6c5077f97954e2e51c9158a3bfa36b86d89f9d6c5e43"
},
"arm64_ventura": {
"cellar": ":any_skip_relocation",
"url": "https://ghcr.io/v2/homebrew/core/swift-format/blobs/sha256:0c7accbe185dba810d3fcd3d734705335e733359ccfa7a5d5ae0cbed480ac058",
"sha256": "0c7accbe185dba810d3fcd3d734705335e733359ccfa7a5d5ae0cbed480ac058"
"url": "https://ghcr.io/v2/homebrew/core/swift-format/blobs/sha256:7fb047e8f80a72e5d8d7ae50c496d0cf59dd3ab654ce6048e4b7fa7b85afe69a",
"sha256": "7fb047e8f80a72e5d8d7ae50c496d0cf59dd3ab654ce6048e4b7fa7b85afe69a"
},
"sonoma": {
"cellar": ":any_skip_relocation",
"url": "https://ghcr.io/v2/homebrew/core/swift-format/blobs/sha256:10ebf6d40cc0c2d4d4cb3309e357e1b6a8d8b5991b5d30c479f3e81587e0c6cd",
"sha256": "10ebf6d40cc0c2d4d4cb3309e357e1b6a8d8b5991b5d30c479f3e81587e0c6cd"
"url": "https://ghcr.io/v2/homebrew/core/swift-format/blobs/sha256:a99a19c9fc177a57b2577e3c1b30feb70f13388fc9c4e4ea7968f783058e09a0",
"sha256": "a99a19c9fc177a57b2577e3c1b30feb70f13388fc9c4e4ea7968f783058e09a0"
},
"ventura": {
"cellar": ":any_skip_relocation",
"url": "https://ghcr.io/v2/homebrew/core/swift-format/blobs/sha256:b12bf9258d6b73fd87d356978e93fa363b4239b50a37c8c2f16b313ad53c5364",
"sha256": "b12bf9258d6b73fd87d356978e93fa363b4239b50a37c8c2f16b313ad53c5364"
"url": "https://ghcr.io/v2/homebrew/core/swift-format/blobs/sha256:a652f68cc4bed9c3186b66c8ee68e79b7387d37943aaff0a0c2d4197367b73fe",
"sha256": "a652f68cc4bed9c3186b66c8ee68e79b7387d37943aaff0a0c2d4197367b73fe"
},
"x86_64_linux": {
"cellar": "/home/linuxbrew/.linuxbrew/Cellar",
"url": "https://ghcr.io/v2/homebrew/core/swift-format/blobs/sha256:b350f38deae722dfb00b33610c82d17d6dcd0db3109f171adb56a3fafe0545a0",
"sha256": "b350f38deae722dfb00b33610c82d17d6dcd0db3109f171adb56a3fafe0545a0"
"cellar": ":any_skip_relocation",
"url": "https://ghcr.io/v2/homebrew/core/swift-format/blobs/sha256:b1949fcb7f1b943fa5b0216bc6f18e12dc369c0538b093786332f851f22b0b03",
"sha256": "b1949fcb7f1b943fa5b0216bc6f18e12dc369c0538b093786332f851f22b0b03"
}
}
}
},
"swiftformat": {
"version": "0.54.6",
"version": "0.54.6_1",
"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/swiftformat/blobs/sha256:fda0a46091e8c4a1a913e08e29a92159ed747d83403508e0b5408e88e68cdf0c",
"sha256": "fda0a46091e8c4a1a913e08e29a92159ed747d83403508e0b5408e88e68cdf0c"
"url": "https://ghcr.io/v2/homebrew/core/swiftformat/blobs/sha256:03eb08eb7de0e697e574b5d5c94104a88c9548ee880b942f1916536fe7ff897a",
"sha256": "03eb08eb7de0e697e574b5d5c94104a88c9548ee880b942f1916536fe7ff897a"
},
"arm64_sonoma": {
"cellar": ":any_skip_relocation",
"url": "https://ghcr.io/v2/homebrew/core/swiftformat/blobs/sha256:2c937e3425e9b44a73eb5ae4a83604b4476f901866014c01c1ebd3f3a8d9c198",
"sha256": "2c937e3425e9b44a73eb5ae4a83604b4476f901866014c01c1ebd3f3a8d9c198"
"url": "https://ghcr.io/v2/homebrew/core/swiftformat/blobs/sha256:0ff9c3c154fea61303bd060da1aecebb025a3a33460b24910cf55e6ae366574e",
"sha256": "0ff9c3c154fea61303bd060da1aecebb025a3a33460b24910cf55e6ae366574e"
},
"arm64_ventura": {
"cellar": ":any_skip_relocation",
"url": "https://ghcr.io/v2/homebrew/core/swiftformat/blobs/sha256:d68be9490bce8cb196933f1f421f791b0b9758a759956edfaf166f88dfca78e1",
"sha256": "d68be9490bce8cb196933f1f421f791b0b9758a759956edfaf166f88dfca78e1"
"url": "https://ghcr.io/v2/homebrew/core/swiftformat/blobs/sha256:52200577da57cebd27e7d4b6a9ed84f6d3475b7f91e28ec4f5947fc2992cd943",
"sha256": "52200577da57cebd27e7d4b6a9ed84f6d3475b7f91e28ec4f5947fc2992cd943"
},
"sonoma": {
"cellar": ":any_skip_relocation",
"url": "https://ghcr.io/v2/homebrew/core/swiftformat/blobs/sha256:784d61fca33bdbbdf96f8f23db2a0ea849ef62cb251eedfe83863869db84359b",
"sha256": "784d61fca33bdbbdf96f8f23db2a0ea849ef62cb251eedfe83863869db84359b"
"url": "https://ghcr.io/v2/homebrew/core/swiftformat/blobs/sha256:9f79e28a0a5c7172be8bfcf23fca47de08f8bc03a3ddcdfbf52704445b9d8b18",
"sha256": "9f79e28a0a5c7172be8bfcf23fca47de08f8bc03a3ddcdfbf52704445b9d8b18"
},
"ventura": {
"cellar": ":any_skip_relocation",
"url": "https://ghcr.io/v2/homebrew/core/swiftformat/blobs/sha256:7845bd9bf8f0f94980f38d0ac322a5ee41bde07d18ec0c93a343c4aa7d2606fe",
"sha256": "7845bd9bf8f0f94980f38d0ac322a5ee41bde07d18ec0c93a343c4aa7d2606fe"
"url": "https://ghcr.io/v2/homebrew/core/swiftformat/blobs/sha256:416528899d45dc25edc2f14c857239a2c922b4be548345423857f140c6b90f0f",
"sha256": "416528899d45dc25edc2f14c857239a2c922b4be548345423857f140c6b90f0f"
},
"x86_64_linux": {
"cellar": "/home/linuxbrew/.linuxbrew/Cellar",
"url": "https://ghcr.io/v2/homebrew/core/swiftformat/blobs/sha256:14756d1f83aedf183be980541393c3e4d9cfa47dee3dbfdb665a3461f5045e13",
"sha256": "14756d1f83aedf183be980541393c3e4d9cfa47dee3dbfdb665a3461f5045e13"
"cellar": ":any_skip_relocation",
"url": "https://ghcr.io/v2/homebrew/core/swiftformat/blobs/sha256:86c47e1a74da98ff5646c8d510ea5e6de45e9dc97bc59f151bd2a8848b5bc9f8",
"sha256": "86c47e1a74da98ff5646c8d510ea5e6de45e9dc97bc59f151bd2a8848b5bc9f8"
}
}
}
@ -284,18 +362,44 @@
}
}
}
}
},
"tap": {
"peripheryapp/periphery": {
"revision": "e3f6467b552f08e874875bfbc7703cb917085e0e"
}
"yamllint": {
"version": "1.35.1",
"bottle": {
"rebuild": 2,
"root_url": "https://ghcr.io/v2/homebrew/core",
"files": {
"arm64_sequoia": {
"cellar": ":any",
"url": "https://ghcr.io/v2/homebrew/core/yamllint/blobs/sha256:cb74d6cc51501733531acd25b26fd474557d19374b98eb7de16271ff2c257860",
"sha256": "cb74d6cc51501733531acd25b26fd474557d19374b98eb7de16271ff2c257860"
},
"cask": {
"periphery": {
"version": "2.9.0",
"options": {
"full_name": "periphery"
"arm64_sonoma": {
"cellar": ":any",
"url": "https://ghcr.io/v2/homebrew/core/yamllint/blobs/sha256:e36b43d6b87028fe2005878cb15c78edec6ddb898e9a86ff7b901fe093cf9c0e",
"sha256": "e36b43d6b87028fe2005878cb15c78edec6ddb898e9a86ff7b901fe093cf9c0e"
},
"arm64_ventura": {
"cellar": ":any",
"url": "https://ghcr.io/v2/homebrew/core/yamllint/blobs/sha256:3591f98aaaebba5e9360926f5ca756dbd85c6a46de0554042376ac83548c7fb3",
"sha256": "3591f98aaaebba5e9360926f5ca756dbd85c6a46de0554042376ac83548c7fb3"
},
"sonoma": {
"cellar": ":any",
"url": "https://ghcr.io/v2/homebrew/core/yamllint/blobs/sha256:3889369233f5f342b73cc70625748a52d72117603b92f352af00a9ebd27cb1c4",
"sha256": "3889369233f5f342b73cc70625748a52d72117603b92f352af00a9ebd27cb1c4"
},
"ventura": {
"cellar": ":any",
"url": "https://ghcr.io/v2/homebrew/core/yamllint/blobs/sha256:209883378df0edf4a0691fd2dbf6f2e8da7776bd9c0de0fc70fa04dd0fc51c8d",
"sha256": "209883378df0edf4a0691fd2dbf6f2e8da7776bd9c0de0fc70fa04dd0fc51c8d"
},
"x86_64_linux": {
"cellar": ":any_skip_relocation",
"url": "https://ghcr.io/v2/homebrew/core/yamllint/blobs/sha256:993514320174f1147d538719552131a73d34cf66dc9f82c38f6ed28b16cea287",
"sha256": "993514320174f1147d538719552131a73d34cf66dc9f82c38f6ed28b16cea287"
}
}
}
}
}
@ -303,20 +407,12 @@
"system": {
"macos": {
"monterey": {
"HOMEBREW_VERSION": "4.4.1-17-gf957e0e",
"HOMEBREW_VERSION": "4.4.2-62-g59d56f8",
"HOMEBREW_PREFIX": "/usr/local",
"Homebrew/homebrew-core": "api",
"CLT": "14.2.0.0.1.1668646533",
"Xcode": "14.2",
"macOS": "12.7.6"
},
"ventura": {
"HOMEBREW_VERSION": "3.6.2-17-g0b602f6",
"HOMEBREW_PREFIX": "/opt/homebrew",
"Homebrew/homebrew-core": "9f43be0861992b9109035ac00e999f66598ba6c2",
"CLT": "14.0.0.0.1.1661618636",
"Xcode": "14.0",
"macOS": "13.0"
}
}
}

View file

@ -1,35 +1,44 @@
# 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.5",
revision: "9da3c3a1f72271e022f02897ed587f2ce1fcddf3"
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.5"
sha256 cellar: :any_skip_relocation, arm64_monterey: "2bf14f3f6cd15b18fe3c96585ceea2d2e538bf1c0c384aba4cd0ac78c19ea287"
sha256 cellar: :any_skip_relocation, arm64_big_sur: "2bf14f3f6cd15b18fe3c96585ceea2d2e538bf1c0c384aba4cd0ac78c19ea287"
sha256 cellar: :any_skip_relocation, monterey: "2bf14f3f6cd15b18fe3c96585ceea2d2e538bf1c0c384aba4cd0ac78c19ea287"
sha256 cellar: :any_skip_relocation, big_sur: "2bf14f3f6cd15b18fe3c96585ceea2d2e538bf1c0c384aba4cd0ac78c19ea287"
sha256 cellar: :any_skip_relocation, catalina: "2bf14f3f6cd15b18fe3c96585ceea2d2e538bf1c0c384aba4cd0ac78c19ea287"
sha256 cellar: :any_skip_relocation, mojave: "2bf14f3f6cd15b18fe3c96585ceea2d2e538bf1c0c384aba4cd0ac78c19ea287"
sha256 cellar: :any_skip_relocation, high_sierra: "2bf14f3f6cd15b18fe3c96585ceea2d2e538bf1c0c384aba4cd0ac78c19ea287"
sha256 cellar: :any_skip_relocation, sierra: "2bf14f3f6cd15b18fe3c96585ceea2d2e538bf1c0c384aba4cd0ac78c19ea287"
sha256 cellar: :any_skip_relocation, el_capitan: "2bf14f3f6cd15b18fe3c96585ceea2d2e538bf1c0c384aba4cd0ac78c19ea287"
root_url "https://github.com/mas-cli/mas/releases/download/v1.8.7-beta.1"
sha256 cellar: :any_skip_relocation, arm64_sonoma: "0d042a450d2623e3ea40db0b645454ee88d1a1763a7aa778eec5beea619b9a60"
sha256 cellar: :any_skip_relocation, arm64_ventura: "0d042a450d2623e3ea40db0b645454ee88d1a1763a7aa778eec5beea619b9a60"
sha256 cellar: :any_skip_relocation, arm64_monterey: "0d042a450d2623e3ea40db0b645454ee88d1a1763a7aa778eec5beea619b9a60"
sha256 cellar: :any_skip_relocation, arm64_big_sur: "0d042a450d2623e3ea40db0b645454ee88d1a1763a7aa778eec5beea619b9a60"
sha256 cellar: :any_skip_relocation, sonoma: "0d042a450d2623e3ea40db0b645454ee88d1a1763a7aa778eec5beea619b9a60"
sha256 cellar: :any_skip_relocation, ventura: "0d042a450d2623e3ea40db0b645454ee88d1a1763a7aa778eec5beea619b9a60"
sha256 cellar: :any_skip_relocation, monterey: "0d042a450d2623e3ea40db0b645454ee88d1a1763a7aa778eec5beea619b9a60"
sha256 cellar: :any_skip_relocation, big_sur: "0d042a450d2623e3ea40db0b645454ee88d1a1763a7aa778eec5beea619b9a60"
sha256 cellar: :any_skip_relocation, catalina: "0d042a450d2623e3ea40db0b645454ee88d1a1763a7aa778eec5beea619b9a60"
sha256 cellar: :any_skip_relocation, mojave: "0d042a450d2623e3ea40db0b645454ee88d1a1763a7aa778eec5beea619b9a60"
sha256 cellar: :any_skip_relocation, high_sierra: "0d042a450d2623e3ea40db0b645454ee88d1a1763a7aa778eec5beea619b9a60"
sha256 cellar: :any_skip_relocation, sierra: "0d042a450d2623e3ea40db0b645454ee88d1a1763a7aa778eec5beea619b9a60"
sha256 cellar: :any_skip_relocation, el_capitan: "0d042a450d2623e3ea40db0b645454ee88d1a1763a7aa778eec5beea619b9a60"
end
depends_on :macos
if Hardware::CPU.arm?
on_arm do
depends_on xcode: ["12.2", :build]
else
end
on_intel do
depends_on xcode: ["12.0", :build]
end
def install
system "script/build", "--universal"
system "script/install", "--universal", prefix
system "script/build"
system "script/install", prefix
bash_completion.install "contrib/completion/mas-completion.bash" => "mas"
fish_completion.install "contrib/completion/mas.fish"

View file

@ -1,24 +1,33 @@
# 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.5",
revision: "9da3c3a1f72271e022f02897ed587f2ce1fcddf3"
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_monterey: "433b94f32da9835c0800975a5f8db08c823c4b8c35077db7e2a9763d700f0fbe"
sha256 cellar: :any_skip_relocation, arm64_big_sur: "446af97db6bcb0f44d61e7486d7c74d14325002ff9918dba7a7db3045bf8b07c"
sha256 cellar: :any_skip_relocation, monterey: "62f08836f3ff705e8b7dd858a5225a0b0bceb39d6bb2340ee469e68ead73a90b"
sha256 cellar: :any_skip_relocation, big_sur: "18fd65b45ff112ca5c80a31202688617a22dec56b28bbb93cf4bdb6ed2d73d56"
sha256 cellar: :any_skip_relocation, catalina: "29d2d552d09ef893c3560d94a01c2985bb53b2e9499400987ad76c9b50b9f0f9"
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 :macos
if Hardware::CPU.arm?
on_arm do
depends_on xcode: ["12.2", :build]
else
end
on_intel do
depends_on xcode: ["12.0", :build]
end

110
Makefile
View file

@ -10,7 +10,7 @@
CMD_NAME = mas
SHELL = /bin/sh
PREFIX ?= /usr/local
PREFIX ?= $(shell brew --prefix)
SWIFT_VERSION = 5.7.1
@ -44,7 +44,7 @@ help: ## (default) Displays this message
################################################################################
#
# Targets
# Info Targets
#
.PHONY: version
@ -59,17 +59,35 @@ init: ## Installs tools.
- swiftenv install $(SWIFT_VERSION)
swiftenv local $(SWIFT_VERSION)
################################################################################
#
# 👢 Bootstrap
#
.PHONY: bootstrap
bootstrap: ## Installs tools.
script/bootstrap -f
.PHONY: bootstrap-update
bootstrap-update: ## Upgrades and installs tools.
script/bootstrap
################################################################################
#
# 👩🏻‍💻 Development Targets
#
.PHONY: clean
clean: ## Cleans built products.
script/clean
.PHONY: updateHeaders
updateHeaders: ## Updates private headers.
script/update_headers
.PHONY: lint
lint: ## Lints source code.
script/lint
.PHONY: format
format: ## Formats source code.
script/format
.PHONY: build
build: ## Builds the project.
@ -84,41 +102,14 @@ test: build ## Runs tests.
run: build
${EXECUTABLE_DIRECTORY}/${CMD_NAME} $(ARGS)
.PHONY: install
install: ## Installs the project.
script/install $(PREFIX)
.PHONY: update-headers
update-headers: ## Updates private macOS headers.
script/update_headers
.PHONY: uninstall
uninstall: ## Uninstalls the project.
script/uninstall
.PHONY: format
format: ## Formats source code.
script/format
.PHONY: lint
lint: ## Lints source code.
script/lint
.PHONY: danger
danger: ## Runs danger.
script/danger
# Builds bottles
.PHONY: bottles
bottles: ## Builds bottles.
script/bottle
.PHONY: bottle
bottle: bottles ## Alias for bottles
.PHONY: package
package: build ## Packages the project.
script/package
.PHONY: packageInstall
packageInstall: package ## Installs the package.
script/package_install
################################################################################
#
# 🕊️ Swift Package Targets
#
.PHONY: describe
describe: ## Describes the Swift package.
@ -135,3 +126,44 @@ dependencies: resolve ## Lists SwiftPM dependencies.
.PHONY: update
update: resolve ## Updates SwiftPM dependencies.
swift package update
################################################################################
#
# 🚀 Release Targets
#
.PHONY: build-universal
build-universal: ## Builds a "fat" universal binary.
script/build --universal
.PHONY: install
install: build ## Installs the binary.
script/install $(PREFIX)
.PHONY: install-universal
install-universal: build-universal ## Installs a universal binary.
script/install --universal
.PHONY: uninstall
uninstall: ## Uninstalls the binary.
script/uninstall
.PHONY: package
package: build ## Packages the project.
script/package
.PHONY: package-install
package-install: package ## Installs the package.
script/package_install
.PHONY: bottle
bottle: ## Builds Homebrew bottles.
script/bottle
.PHONY: brew_formula_update
brew_formula_update: ## Updates homebrew-core formula.
script/brew_formula_update
.PHONY: brew_release_validate
brew_release_validate: ## Builds Homebrew bottle for the current system.
script/brew_release_validate

View file

@ -4,6 +4,7 @@
#
# https://github.com/realm/SwiftLint#configuration
#
---
disabled_rules:
- force_cast

View file

@ -13,10 +13,43 @@ if ! cd -- "${mas_dir}"; then
exit 1
fi
function usage {
echo "Usage: bootstrap [-f]"
echo " -f option enables frozen mode"
exit 1
}
frozen=''
# Detect presence of `-f` frozen option
while getopts "f" opt; do
case "${opt}" in
f)
frozen='-f'
;;
*)
usage 1>&2
;;
esac
done
script/clean
printf $'==> 👢 Bootstrapping (%s)\n' "$(script/version)"
# Install Homebrew tools
if [[ "${frozen}" == "-f" ]]; then
# --no-lock Don't touch Brewfile.lock.json
brew bundle install --no-lock --no-upgrade --verbose
else
# Allow upgrades
rm -f Brewfile.lock.json
brew bundle install --no-upgrade --verbose
brew bundle install --verbose
fi
if [[ ! -x "$(command -v mise)" ]]; then
brew install mise
fi
mise settings set experimental true
mise install --verbose
mise list --verbose

View file

@ -1,4 +1,4 @@
#!/bin/bash -e
#!/bin/bash -ex
#
# script/bottle
# mas
@ -6,101 +6,130 @@
# Builds bottles of mas Homebrew formula for custom tap:
# https://github.com/mas-cli/homebrew-tap
#
# This script should be run _after_ the formula has been updated in Homebrew
#
################################################################################
#
# Variables
#
BUILD_DIR="$PWD/.build"
BOTTLE_DIR="$BUILD_DIR/bottles"
VERSION=$(script/version)
ROOT_URL="https://github.com/mas-cli/mas/releases/download/v${VERSION}"
BUILD_DIR="${PWD}/.build"
BOTTLE_DIR="${BUILD_DIR}/bottles"
CORE_TAP_PATH="$(brew --repository homebrew/core)"
MAS_VERSION=$(script/version)
ROOT_URL="https://github.com/mas-cli/mas/releases/download/v${MAS_VERSION}"
# Supports macOS 10.13 and later
OS_NAMES=(arm64_monterey monterey arm64_big_sur big_sur catalina mojave high_sierra)
OS_NAMES=(
sequoia
arm64_sequoia
sonoma
arm64_sonoma
ventura
arm64_ventura
monterey
arm64_monterey
big_sur
arm64_big_sur
catalina
mojave
high_sierra
sierra
el_capitan
)
# Semantic version number split into a list using Ugly, bash 3 compatible syntax
IFS=" " read -r -a CURRENT_OS_VERSION <<<"$(sw_vers -productVersion | sed 's/\./ /g'))"
# Semantic version number split into a list using ugly, bash 3 compatible syntax
IFS=" " read -r -a CURRENT_OS_VERSION <<<"$(sw_vers -productVersion | sed 's/\./ /g')"
CURRENT_OS_VERSION_MAJOR=${CURRENT_OS_VERSION[0]}
CURRENT_OS_VERSION_MINOR=${CURRENT_OS_VERSION[1]}
echo "CURRENT_OS_VERSION_MAJOR: $CURRENT_OS_VERSION_MAJOR"
echo "CURRENT_OS_VERSION_MINOR: $CURRENT_OS_VERSION_MINOR"
echo "CURRENT_OS_VERSION_MAJOR: ${CURRENT_OS_VERSION_MAJOR}"
echo "CURRENT_OS_VERSION_MINOR: ${CURRENT_OS_VERSION_MINOR}"
if [[ ${CURRENT_OS_VERSION_MAJOR} == "12" ]]; then
if [[ "x86_64" == "$(uname -m)" ]]; then
case "${CURRENT_OS_VERSION_MAJOR}" in
15)
CURRENT_PLATFORM=sequoia
;;
14)
CURRENT_PLATFORM=sonoma
;;
13)
CURRENT_PLATFORM=ventura
;;
12)
CURRENT_PLATFORM=monterey
else
CURRENT_PLATFORM=arm64_monterey
fi
elif [[ ${CURRENT_OS_VERSION_MAJOR} == "11" ]]; then
# Big Sur
if [[ "x86_64" == "$(uname -m)" ]]; then
;;
11)
CURRENT_PLATFORM=big_sur
else
CURRENT_PLATFORM=arm64_big_sur
fi
elif [[ ${CURRENT_OS_VERSION_MAJOR} == "10" && ${CURRENT_OS_VERSION_MINOR} == "15" ]]; then
;;
10)
CURRENT_PLATFORM=catalina
else
;;
*)
echo "Unsupported macOS version. This script requires Catalina or better."
exit 1
;;
esac
# Prefix platform with architecture
if [[ "arm64" == "$(uname -m)" ]]; then
CURRENT_PLATFORM="arm64_${CURRENT_PLATFORM}"
fi
echo "CURRENT_PLATFORM: ${CURRENT_PLATFORM}"
# Output filename from build-bottle command
OLD_FILENAME="mas--${VERSION}.${CURRENT_PLATFORM}.bottle.tar.gz"
OLD_FILENAME="mas--${MAS_VERSION}.${CURRENT_PLATFORM}.bottle.tar.gz"
################################################################################
#
# Preflight checks
#
# Uninstall if necessary
brew remove mas 2>/dev/null || true # ignore failure
brew remove mas-cli/tap/mas 2>/dev/null || true #ignore failure
# # 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 # ignore failure
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
brew style mas-cli/tap/mas
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} for: ${OS_NAMES[*]}"
echo "==> 🍼 Bottling mas ${MAS_VERSION} for: ${OS_NAMES[*]}"
brew install --build-bottle mas-cli/tap/mas
# Generate bottle do block, dropping last 2 lines
brew bottle --verbose --no-rebuild --root-url="$ROOT_URL" mas-cli/tap/mas
brew bottle --verbose --no-rebuild --root-url="${ROOT_URL}" mas-cli/tap/mas
if ! test -e "${OLD_FILENAME}"; then
echo "Bottle not found: ${OLD_FILENAME}"
echo "If an old version is showing in the log and filename, then make sure the formula has been updated in:"
echo "<BREW_HOME>/Library/Taps/homebrew/homebrew-core"
echo "${CORE_TAP_PATH}"
exit 1
fi
SHA256=$(shasum --algorithm 256 "${OLD_FILENAME}" | cut -f 1 -d ' ' -)
mkdir -p "$BOTTLE_DIR"
mkdir -p "${BOTTLE_DIR}"
# Start of bottle block
BOTTLE_BLOCK=$(
cat <<-EOF
bottle do
root_url "$ROOT_URL"
root_url "${ROOT_URL}"
EOF
)
@ -111,15 +140,15 @@ EOF
# Fix filename
for os in "${OS_NAMES[@]}"; do
new_filename="mas-${VERSION}.${os}.bottle.tar.gz"
new_filename="mas-${MAS_VERSION}.${os}.bottle.tar.gz"
cp -v "${OLD_FILENAME}" "${BOTTLE_DIR}/${new_filename}"
# Append each os
# BOTTLE_BLOCK="$(printf "${BOTTLE_BLOCK}\n sha256 cellar: :any_skip_relocation, %-15s %s" "${os}:" "${SHA256}")"
BOTTLE_BLOCK="$BOTTLE_BLOCK"$(
BOTTLE_BLOCK="${BOTTLE_BLOCK}"$(
cat <<-EOF
sha256 cellar: :any_skip_relocation, $os: "$SHA256"
sha256 cellar: :any_skip_relocation, ${os}: "${SHA256}"
EOF
)
done
@ -135,7 +164,3 @@ EOF
rm "${OLD_FILENAME}"
ls -l "${BOTTLE_DIR}"
echo "${BOTTLE_BLOCK}"
brew remove mas-cli/tap/mas
open "${BOTTLE_DIR}"

11
script/brew_build_interactive Executable file
View file

@ -0,0 +1,11 @@
#!/bin/bash -e
#
# script/brew_build_interactive
# mas
#
# https://docs.brew.sh/Formula-Cookbook#check-the-build-system
#
HOMEBREW_NO_INSTALL_FROM_API=1 \
brew reinstall \
--interactive mas

169
script/brew_core_update Executable file
View file

@ -0,0 +1,169 @@
#!/bin/bash -ex
#
# script/brew_core_update
# mas
#
# Updates mas Homebrew core formula:
# https://github.com/Homebrew/homebrew-core/blob/master/Formula/mas.rb
#
# brew bump-formula-pr --help
#
CORE_TAP_PATH="$(brew --repository homebrew/core)"
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"
function usage {
echo "Usage: brew_core_update [-d] v0.0 [sha1_hash]"
echo " -d option enables dry run mode"
echo " version will be inferred using version script if not provided"
echo " sha will be inferred from the current commit if not provided"
exit 1
}
# Max 3 arguments
if [[ $# -gt 3 ]]; then
usage 1>&2
fi
echo=''
dry_run=''
# Detect presence of `-d` dry run option
while getopts "d" o; do
case "${o}" in
d)
echo='echo (DRY-RUN):'
dry_run='-d'
;;
*)
usage 1>&2
;;
esac
done
shift $((OPTIND - 1))
# DRY_RUN environment variable
# shellcheck disable=SC2153
if [[ $DRY_RUN == 'true' ]]; then
echo='echo (DRY-RUN):'
dry_run='-d'
fi
# arg 1 - version tag
if [[ -n "${1}" ]]; then
MAS_VERSION="${1}"
else
MAS_VERSION="v$(script/version)"
fi
echo "MAS_VERSION: ${MAS_VERSION}"
# arg 2 - revision (commit hash)
if [[ -n "${2}" ]]; then
REVISION="${2}"
else
# Derive revision from version. Fails if MAS_VERSION is not a tag.
REVISION=$(git rev-parse "${MAS_VERSION}")
fi
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 "${LOCAL_MAS_FORMULA_PATH}" "${CORE_MAS_FORMULA_FILE}"
# 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 "Checking to see if this update can be a simple bump."
# diff "${LOCAL_MAS_FORMULA_PATH}" "${CORE_MAS_FORMULA_FILE}"
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'"
exit ${status}
fi
if [[ $dry_run == '-d' ]]; then
exit 0
fi
pushd "${CORE_TAP_PATH}"
echo "Updating homebrew/core formula with a PR"
$echo brew bump-formula-pr \
--tag="${MAS_VERSION}" \
--revision="${REVISION}" \
--strict \
--verbose \
--online \
--no-browse \
--fork-org mas-cli \
mas
popd

View file

@ -1,77 +0,0 @@
#!/bin/bash -e
#
# script/brew_formula_update
# mas
#
# Updates mas Homebrew core formula:
# https://github.com/Homebrew/homebrew-core/blob/master/Formula/mas.rb
#
# brew bump-formula-pr --help
#
BREW_CORE_PATH="$(brew --prefix)/Library/Taps/homebrew/homebrew-core/Formula"
function usage {
echo "Usage: brew_formula_bump [v1.0] [sha1_hash]"
echo "- version will be inferred using version script if not provided"
echo "- sha will be inferred from the current commit if not provided"
exit 1
}
# arg 1 - version tag
if test -n "$1"; then
VERSION="$1"
else
VERSION="v$(script/version)"
fi
# arg 2 - revision (commit hash)
if test -n "$2"; then
REVISION="$2"
else
REVISION=$(git rev-parse "$VERSION")
fi
echo "Checking to see if this update can be a simple bump."
diff "Homebrew/mas.rb" "$BREW_CORE_PATH/mas.rb"
# diff exit status
status=$?
formula_revisions=0
if test $status -ne 0; then
echo "There are changes in the local formula (Homebrew/mas.rb) that haven't been released yet."
#exit $status
formula_revisions=1
fi
echo "==> 🧪 Updating homebrew-core formula mas ($VERSION, $REVISION)"
echo "Validating formula"
brew bump-formula-pr \
--tag="$VERSION" \
--revision="$REVISION" \
--strict \
mas
# brew exit status
status=$?
if test $status -ne 0; then
echo "Formula did not validate using 'brew bump-formula-pr'"
exit $status
fi
pushd "$BREW_CORE_PATH" || exit 2
echo "Updating formula"
if test $formula_revisions -eq 1; then
# Options to
dry_run="--dry-run --write"
fi
brew bump-formula-pr \
--tag="$VERSION" \
--revision="$REVISION" \
--strict \
--verbose \
"$dry_run" \
mas

43
script/brew_tap_update Executable file
View file

@ -0,0 +1,43 @@
#!/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
#
function usage {
echo "Usage: brew_tap_update [-d] v0.0 [sha1_hash]"
echo " -d option enables dry run mode"
echo " version will be inferred using version script if not provided"
echo " sha will be inferred from the current commit if not provided"
exit 1
}
# Max 3 arguments
if [[ $# -gt 3 ]]; then
usage 1>&2
fi
# arg 1 - version tag
if [[ -n "${1}" ]]; then
MAS_VERSION="${1}"
else
MAS_VERSION="v$(script/version)"
fi
echo "MAS_VERSION: ${MAS_VERSION}"
# arg 2 - revision (commit hash)
if [[ -n "${2}" ]]; then
REVISION="${2}"
else
# Derive revision from version. Fails if MAS_VERSION is not a tag.
REVISION=$(git rev-parse "${MAS_VERSION}")
fi
echo "REVISION: ${REVISION}"
# Build in mas project
script/bottle

View file

@ -1,14 +0,0 @@
#!/bin/bash -e
#
# script/build_artifacts
# mas
#
# Runs all related scripts for generating all artifacts.
#
VERSION=$(script/version)
echo "Updating mas $VERSION Homebrew formula"
script/brew_formula_update
script/bottle

View file

@ -15,8 +15,11 @@ fi
# Build for the host architecture by default.
ARCH=()
if [[ "${#}" -gt 1 && "${1}" == '--universal' ]]; then
ARCH=(--arch arm64 --arch x86_64)
if [[ "${#}" -ge 1 && "${1}" == '--universal' ]]; then
ARCH=(
--arch arm64
--arch x86_64
)
fi
# Disable the manifest cache on Xcode 12.5 and later.
@ -25,7 +28,7 @@ if [[ "$(swift build --help)" =~ manifest-cache ]]; then
CACHE=(--manifest-cache none)
fi
echo "==> 🏗️ Building mas ($(script/version))"
echo "==> 🏗️ Building mas ($(script/version --write))"
swift build \
--configuration release \
"${ARCH[@]+"${ARCH[@]}"}" \

View file

@ -6,9 +6,9 @@
# Runs all related scripts for generating all artifacts.
#
VERSION=$(script/version)
MAS_VERSION=$(script/version)
echo "Building mas $VERSION artifacts"
echo "Building mas $MAS_VERSION artifacts"
script/clean
script/build --universal

View file

@ -19,7 +19,7 @@ fi
printf $'==> 🚨 Formatting mas\n'
for LINTER in markdownlint shfmt swift-format swiftformat swiftlint; do
for LINTER in markdownlint prettier shfmt swift-format swiftformat swiftlint yamllint; do
if [[ ! -x "$(command -v ${LINTER})" ]]; then
printf $'error: %s is not installed. Run \'script/bootstrap\' or \'brew install %s\'.\n' "${LINTER}" "${LINTER}"
exit 1
@ -45,3 +45,7 @@ shfmt \
printf -- $'--> 〽️ Markdown\n'
markdownlint --config .markdownlint.json --fix .github .
printf -- $'--> 🖊 YAML\n'
# shellcheck disable=SC2046
prettier --write $(yamllint --list-files .)

View file

@ -12,13 +12,8 @@
ARCH=$(uname -m)
RELEASE=.build/${ARCH}-apple-macosx/release
VERSION=$(script/version)
if [[ $(uname -m) == 'arm64' ]]; then
PREFIX=/opt/homebrew
else
MAS_VERSION=$(script/version)
PREFIX=/usr/local
fi
while test -n "$1"; do
if [[ "$1" == '--universal' ]]; then
@ -32,7 +27,7 @@ while test -n "$1"; do
shift
done
echo "==> 📲 Installing mas ($VERSION) for $ARCH to $PREFIX"
echo "==> 📲 Installing mas ($MAS_VERSION) for $ARCH to $PREFIX"
ditto -v \
"$RELEASE/mas" \
"$PREFIX/bin/"
"$PREFIX/bin/mas"

View file

@ -19,9 +19,9 @@ if ! cd -- "${mas_dir}"; then
exit 1
fi
printf $'==> 🚨 Linting mas (%s)\n' "$(script/version)"
printf $'==> 🚨 Linting mas (%s)\n' "$(script/version --write)"
for linter in git markdownlint periphery shellcheck shfmt swift-format swiftformat swiftlint; do
for linter in git markdownlint periphery shellcheck shfmt swift-format swiftformat swiftlint yamllint; do
if [[ ! -x "$(command -v ${linter})" ]]; then
printf $'error: %s is not installed. Run \'script/bootstrap\' or \'brew install %s\'.\n' "${linter}" "${linter}"
exit 1
@ -64,6 +64,10 @@ printf -- $'--> 🌳 Git\n'
PAGER='cat' git diff --check
((exit_code |= "${?}"))
printf -- $'--> 🖊 YAML\n'
yamllint .
((exit_code |= "${?}"))
printf -- $'--> 🌀 Periphery\n'
script -q /dev/null periphery scan --strict --quiet --disable-update-check |
(grep -vxE '(?:\x1b\[0;1;32m|\^D\x08{2})\* (?:\x1b\[0;0m\x1b\[0;1m)?No unused code detected\.(?:\x1b\[0;0m)?\r' || true)

View file

@ -20,7 +20,7 @@ DISTRIBUTION_PLIST="Package/Distribution.plist"
DSTROOT=.build/distributions
script/install "$DSTROOT/usr/local" --universal
VERSION=$(script/version)
MAS_VERSION=$(script/version)
echo "==> 📦 Assemble an installer package"
@ -28,7 +28,7 @@ echo "==> 📦 Assemble an installer package"
pkgbuild \
--identifier "$IDENTIFIER" \
--install-location "/" \
--version "$VERSION" \
--version "$MAS_VERSION" \
--root "$DSTROOT" \
"$COMPONENT_PACKAGE"

View file

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

View file

@ -9,12 +9,10 @@
# Override default prefix path with optional 1st arg
if test -n "$1"; then
PREFIX="$1"
elif [[ $(uname -m) == 'arm64' ]]; then
PREFIX=/opt/homebrew
else
PREFIX=/usr/local
PREFIX=$(brew --prefix)
fi
echo "==> 🔥 Uninstalling mas from $PREFIX"
trash -F "$PREFIX/bin/mas"
trash -F "$PREFIX/bin/mas" || true

View file

@ -6,9 +6,6 @@
# Displays the current marketing version of mas.
#
# This no longer works with MARKETING_VERSION build setting in Info.plist
# agvtool what-marketing-version -terse1
mas_dir="$(readlink -fn "$(dirname "${BASH_SOURCE:-"${0}"}")/..")"
if ! cd -- "${mas_dir}"; then
@ -16,14 +13,18 @@ if ! cd -- "${mas_dir}"; then
exit 1
fi
VERSION=$(git describe --abbrev=0 --tags)
VERSION=${VERSION#v}
if [[ -z "${MAS_VERSION:-}" ]] && git describe >/dev/null 2>&1; then
# Use last tag if MAS_VERSION environment variable is unset or empty
MAS_VERSION=$(git describe --abbrev=0 --tags 2>/dev/null || true)
fi
echo "${MAS_VERSION#v}"
cat <<EOF >"Sources/mas/Package.swift"
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 = "${VERSION}"
static let version = "${MAS_VERSION#v}"
}
EOF
echo "${VERSION}"
fi

61
script/version_bump Executable file
View file

@ -0,0 +1,61 @@
#!/bin/bash -eu
#
# script/version_bump
# mas
#
# Increments the marketing version of mas.
#
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
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: version_bump v0.0 [sha1_hash]"
echo "- existing tag name"
echo "- sha will be inferred from the given tag if not provided"
exit 1
}
if [[ $# -lt 1 ]]; then
usage
fi
# arg 1 - version tag
MAS_VERSION="${1}"
# arg 2 - revision (commit hash)
if [[ "${#}" -ge 2 ]]; then
REVISION="${2}"
else
REVISION=$(git rev-parse "${MAS_VERSION}")
fi
echo "MAS_VERSION: ${MAS_VERSION}"
echo "REVISION: ${REVISION}"
# Write new version into swift package
cat <<EOF >"${SWIFT_PACKAGE}"
/// Generated by \`script/version_bump\`.
enum Package {
static let version = "${MAS_VERSION#v}"
}
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