Skip to content

Commit

Permalink
Merge pull request #7 from wadakatu/feature/actions/macos-installation
Browse files Browse the repository at this point in the history
add github actions for checking the installation to macos-latest
  • Loading branch information
wadakatu authored Jan 5, 2025
2 parents 3ec1777 + 85465ad commit a202330
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 18 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/installation.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: installation for macos-latest
on:
pull_request:
types:
- opened
- reopened
- synchronize

permissions:
contents: read

jobs:
installation:
runs-on: macos-latest
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4
- name: Setup Dotfiles
run: sh init.sh
35 changes: 20 additions & 15 deletions brew.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
if ! type "brew" >/dev/null 2>&1; then
echo "installing Homebrew ..."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
if [[ -x /opt/homebrew/bin/brew ]]; then
eval "$(/opt/homebrew/bin/brew shellenv)"
elif [[ -x /usr/local/bin/brew ]]; then
eval "$(/usr/local/bin/brew shellenv)"
else
echo "Error: Homebrew installation failed." >&2
exit 1
fi
#!/bin/bash

if [ "$(uname)" != "Darwin" ] ; then
echo "Not macOS!"
exit 1
fi

echo "run brew doctor ..."
brew doctor || { echo "brew doctor failed" >&2; exit 1; }
echo "run install Homebrew ..."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" || { echo "installing Homebrew failed" >&2; exit 1; }

echo "run remove homebrew/core, homebrew/cask"
brew untap homebrew/core homebrew/cask

echo "run brew update ..."
brew update || { echo "brew update failed" >&2; exit 1; }
Expand All @@ -21,7 +18,15 @@ echo "run brew upgrade ..."
brew upgrade || { echo "brew upgrade failed" >&2; exit 1; }

echo "run brew bundle ..."
brew bundle --file="${THIS_DIR}/Brewfile" || { echo "brew bundle failed" >&2; exit 1; }
brew bundle --file="${THIS_DIR}" || { echo "brew bundle failed" >&2; exit 1; }

echo "run brew cleanup ..."
brew cleanup || { echo "brew cleanup failed" >&2; exit 1; }
brew uninstall [email protected]
brew uninstall [email protected]
brew cleanup || { echo "brew cleanup failed" >&2; exit 1; }

echo "run brew autoremove ..."
brew autoremove || { echo "brew autoremove failed" >&2; exit 1; }

echo "run brew doctor ..."
brew doctor || { echo "brew doctor failed" >&2; exit 1; }
6 changes: 3 additions & 3 deletions init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ echo "Dotfiles installation started."

# Rosetta
if ! sudo softwareupdate --install-rosetta --agree-to-license; then
echo "Rosetta installation failed." >&2
echo "::error::Rosetta installation failed." >&2
exit 1
fi

# Dotfiles
sh "${THIS_DIR}/symlink.sh"
sh "${THIS_DIR}/symlink.sh" || { echo "::error::Symlink setup failed"; exit 1; }

# Homebrew
sh "${THIS_DIR}/brew.sh"
sh "${THIS_DIR}/brew.sh" || { echo "::error::Homebrew setup failed"; exit 1; }

# zshを使用している場合のみ再読み込み
if [ "$SHELL" = "/bin/zsh" ] || [ "$SHELL" = "/usr/bin/zsh" ]; then
Expand Down

0 comments on commit a202330

Please sign in to comment.