Skip to content

Commit

Permalink
feat: add init script (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
mehdicopter authored Jan 9, 2023
1 parent d6bb0de commit d0e5cc6
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 6 deletions.
10 changes: 6 additions & 4 deletions .github/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ repository:

labels:
- name: homebrew
color: '#f6b650'
color: "#f6b650"
description: Package Manager for macOS
- name: renovate
color: '#047ca3'
color: "#047ca3"
description: Renovate Bot
- name: settings
color: '#845ec2'
color: "#845ec2"
description: Repository Settings

collaborators:
Expand All @@ -34,7 +34,9 @@ branches:
- name: main
protection:
required_conversation_resolution: true
required_pull_request_reviews: {}
required_pull_request_reviews:
dismiss_stale_reviews: true
require_code_owner_reviews: true
required_status_checks:
strict: true
contexts: ["commitlint"]
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/commitlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on: pull_request

jobs:
commitlint:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- uses: actions/[email protected]
with:
Expand Down
11 changes: 11 additions & 0 deletions .github/workflows/shellcheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: ShellCheck
on: pull_request

jobs:
shellcheck:
runs-on: ubuntu-22.04
steps:
- uses: actions/[email protected]
with:
fetch-depth: 0
- uses: ludeeus/action-shellcheck@master
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
# dotfiles
# dotfiles

This repository exists to manage my dotfiles and bootstrap my workstation.

## Init

On a brand new machine launch this script :

```sh
curl -fsSL https://raw.githubusercontent.com/mehdicopter/dotfiles/main/install.sh | bash
```
46 changes: 46 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/bin/bash

set -eufo pipefail

# Update Macbook
read -r -n 1 -s -p $'Do you want to update your MacBook (y/n)? \n' answer

case $answer in
y|Y)
echo ""
echo $'๐ŸŽˆ Updating MacBook\n'
sudo softwareupdate --install --all --restart
;;
*)
echo ""
echo "๐Ÿ›ธ Skipped MacBook update"
;;
esac

export PATH=/opt/homebrew/bin:$PATH

# Install Homebrew
command -v brew >/dev/null 2>&1 || \
(echo "๐Ÿบ Installing Homebrew" && /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)")

# Install Oh My Zsh
if [ ! -f ~/.oh-my-zsh/oh-my-zsh.sh ]; then
(echo "๐Ÿ‘พ Installing oh-my-zsh" && yes | sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)")
fi

# Install chezmoi
command -v chezmoi >/dev/null 2>&1 || \
(echo "๐Ÿ  Installing chezmoi" && brew install chezmoi)

if [ -d "$HOME/.local/share/chezmoi/.git" ]; then
echo ""
echo "๐Ÿšธ chezmoi already initialized"
echo " Reinitialize with: 'chezmoi init https://github.com/mehdicopter/dotfiles.git'"
else
echo ""
echo "๐Ÿš€ Initializing dotfiles"
chezmoi init --apply https://github.com/mehdicopter/dotfiles.git
fi

echo ""
echo "Done."

0 comments on commit d0e5cc6

Please sign in to comment.