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: | 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/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 diff --git a/home/dot_config/brew/MasBrewfile b/home/dot_config/brew/MasBrewfile new file mode 100644 index 0000000..e69de29