🔨 Add frozen (-f) option to bootstrap script

GHA jobs use -f so pinned version of tools are installed, if necessary.

New bootstrap-update make target upgrades tools
This commit is contained in:
Ben Chatelain 2024-03-30 11:03:55 -06:00
parent 37cf3116b1
commit 1b7d6fd81b
No known key found for this signature in database
4 changed files with 39 additions and 6 deletions

View file

@ -28,7 +28,7 @@ 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: Bootstrap - name: Bootstrap
run: script/bootstrap run: script/bootstrap -f
- name: Build - name: Build
run: script/build run: script/build
- name: Test - name: Test

View file

@ -59,7 +59,7 @@ jobs:
- name: 👢 Bootstrap - name: 👢 Bootstrap
run: | run: |
script/bootstrap script/bootstrap -f
# Important to trigger a universal build first as package just works with # Important to trigger a universal build first as package just works with
# the `mas` binary in finds in the build dir. # the `mas` binary in finds in the build dir.
@ -91,7 +91,7 @@ jobs:
- name: 👢 Bootstrap - name: 👢 Bootstrap
run: | run: |
script/bootstrap script/bootstrap -f
- name: 🍺 Update Homebrew mas formula - name: 🍺 Update Homebrew mas formula
run: | run: |
@ -110,7 +110,7 @@ jobs:
- name: 👢 Bootstrap - name: 👢 Bootstrap
run: | run: |
script/bootstrap script/bootstrap -f
- name: 🚰 Update mas tap formula - name: 🚰 Update mas tap formula
run: | run: |

View file

@ -72,6 +72,10 @@ init: ## Installs tools.
.PHONY: bootstrap .PHONY: bootstrap
bootstrap: ## Installs tools. bootstrap: ## Installs tools.
script/bootstrap -f
.PHONY: bootstrap-update
bootstrap-update: ## Upgrades and installs tools.
script/bootstrap script/bootstrap
################################################################################ ################################################################################

View file

@ -6,14 +6,43 @@
# Installs development dependencies and builds project dependencies. # Installs development dependencies and builds project dependencies.
# #
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
echo "${opt}"
case "${opt}" in
f)
frozen='-f'
;;
*)
usage 1>&2
;;
esac
done
main() { main() {
script/clean script/clean
echo "==> 👢 Bootstrapping" echo "==> 👢 Bootstrapping"
# Install Homebrew tools # Install Homebrew tools
rm -f Brewfile.lock.json if [[ "${frozen}" == "-f" ]]; then
brew bundle install --no-upgrade --verbose # --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 --verbose
fi
if [[ ! -x "$(command -v mise)" ]]; then if [[ ! -x "$(command -v mise)" ]]; then
brew install mise brew install mise