From fd5f3ed0a0a011696f66730f3dcd42a55ee4ebf6 Mon Sep 17 00:00:00 2001 From: Mehdi MAHFOUDI Date: Tue, 20 Dec 2022 11:48:24 +0100 Subject: [PATCH] docs: add init section ci: create shellcheck workflow feat: add init install script chore: update settings --- .github/settings.yml | 10 ++++--- .github/workflows/commitlint.yml | 2 +- .github/workflows/shellcheck.yml | 11 ++++++++ README.md | 12 ++++++++- install.sh | 46 ++++++++++++++++++++++++++++++++ 5 files changed, 75 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/shellcheck.yml create mode 100644 install.sh diff --git a/.github/settings.yml b/.github/settings.yml index 067153c..654aac7 100644 --- a/.github/settings.yml +++ b/.github/settings.yml @@ -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: @@ -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"] diff --git a/.github/workflows/commitlint.yml b/.github/workflows/commitlint.yml index aa51921..24833f9 100644 --- a/.github/workflows/commitlint.yml +++ b/.github/workflows/commitlint.yml @@ -3,7 +3,7 @@ on: pull_request jobs: commitlint: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v3.3.0 with: diff --git a/.github/workflows/shellcheck.yml b/.github/workflows/shellcheck.yml new file mode 100644 index 0000000..e38e7ee --- /dev/null +++ b/.github/workflows/shellcheck.yml @@ -0,0 +1,11 @@ +name: ShellCheck +on: pull_request + +jobs: + shellcheck: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v3.2.0 + with: + fetch-depth: 0 + - uses: ludeeus/action-shellcheck@master diff --git a/README.md b/README.md index 27ef622..c0124e9 100644 --- a/README.md +++ b/README.md @@ -1 +1,11 @@ -# dotfiles \ No newline at end of file +# 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 +``` diff --git a/install.sh b/install.sh new file mode 100644 index 0000000..c0fe421 --- /dev/null +++ b/install.sh @@ -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."