From e5d2ec02f352383da5266b5d8d485b70b1ad5802 Mon Sep 17 00:00:00 2001 From: Collie Tsai Date: Tue, 22 Apr 2025 07:51:02 +0800 Subject: [PATCH 1/3] add mas packages --- home/dot_config/brew/Brewfile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/home/dot_config/brew/Brewfile b/home/dot_config/brew/Brewfile index b8a9b85..28ef67b 100644 --- a/home/dot_config/brew/Brewfile +++ b/home/dot_config/brew/Brewfile @@ -21,6 +21,7 @@ brew "git" brew "gnu-tar" brew "hugo" brew "llvm" +brew "mas" brew "mold" brew "neovim" brew "ninja" @@ -50,3 +51,7 @@ cask "telegram" cask "vchewing" cask "vesktop" cask "visual-studio-code" +mas "LINE", id: 539883307 +mas "Messenger", id: 1480068668 +mas "Steam", id: 413730677 +mas "Telegram", id: 747648890 From d5732ebeeacaf7148cab74eaadb780d5717304f4 Mon Sep 17 00:00:00 2001 From: Collie Tsai Date: Wed, 23 Apr 2025 03:57:08 +0800 Subject: [PATCH 2/3] try skip mas install SOP when mas is not setup --- .../install-packages_darwin.tmpl | 25 ++++++++++++++++++- home/dot_config/brew/MasBrewfile | 0 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 home/dot_config/brew/MasBrewfile diff --git a/home/.chezmoitemplates/install-packages_darwin.tmpl b/home/.chezmoitemplates/install-packages_darwin.tmpl index 7fd4361..148ed10 100644 --- a/home/.chezmoitemplates/install-packages_darwin.tmpl +++ b/home/.chezmoitemplates/install-packages_darwin.tmpl @@ -1,2 +1,25 @@ # this comment is to make script update when Brewfile is modified {{- include (joinPath .chezmoi.sourceDir "dot_config/brew/Brewfile") | sha256sum }} -brew bundle install --file="${HOME}/.config/brew/Brewfile" \ No newline at end of file +brew bundle install --file="${HOME}/.config/brew/Brewfile" + +if command -v mas >/dev/null 2>&1; then +if mas account >/dev/null 2>&1; then + echo -e "${GREEN}Installing Mac App Store apps via mas${NC}" + MAS_BREWFILE="${HOME}/.config/brew/MasBrewfile" + if [ -f "$MAS_BREWFILE" ]; then + grep '^mas ' "$MAS_BREWFILE" | while read -r line; do + # 解析 id + app_id=$(echo "$line" | sed -n 's/.*id: *\([0-9]\+\).*/\1/p') + if [ -n "$app_id" ]; then + echo -e "${GREEN}Installing app id: $app_id${NC}" + mas install "$app_id" + fi + done + else + echo -e "${GREEN}[mas] 找不到 MasBrewfile,跳過 mas 安裝流程${NC}" + fi +else + echo -e "${GREEN}[mas] 未登入 Apple ID,跳過 mas 安裝流程${NC}" +fi +else +echo -e "${GREEN}[mas] 未安裝 mas,跳過 mas 安裝流程${NC}" +fi \ No newline at end of file diff --git a/home/dot_config/brew/MasBrewfile b/home/dot_config/brew/MasBrewfile new file mode 100644 index 0000000..e69de29 From 13486fb3c907dfb1a13a0ee6c716f0cd36f7e2dc Mon Sep 17 00:00:00 2001 From: Collie Tsai Date: Sat, 9 Aug 2025 22:20:00 +0800 Subject: [PATCH 3/3] ci: skip Mac App Store installations in GitHub Actions Add HOMEBREW_BUNDLE_MAS_SKIP environment variable to macOS CI workflow to prevent Homebrew Bundle from attempting Mac App Store installations which are not supported in GitHub Actions environment. --- .github/workflows/test-distros.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test-distros.yaml b/.github/workflows/test-distros.yaml index e6bdc18..659d77d 100644 --- a/.github/workflows/test-distros.yaml +++ b/.github/workflows/test-distros.yaml @@ -61,6 +61,8 @@ jobs: deploy-on-macos: name: macos:latest runs-on: macos-latest + env: + HOMEBREW_BUNDLE_MAS_SKIP: "all" # Skip all Mac App Store installations in CI (official Homebrew Bundle env var) steps: - name: Prepare environment run: |