From fdeeac3e3a504ff6d0887417dd35a02f4be679fa Mon Sep 17 00:00:00 2001 From: Kilian Tyler Date: Wed, 4 Sep 2024 20:55:10 -0400 Subject: [PATCH] chore: update doc deploys + others --- .devcontainer/devcontainer.json | 17 ++++-- .github/workflows/docs-deploy.yaml | 16 ++--- .github/workflows/docs-test-deploy.yaml | 12 ++-- .trunk/configs/.yamllint.yaml | 2 +- docs/public/install | 61 +++++++++++++++++++ .../run_once_before_0-decrypt_age_key.sh.tmpl | 2 +- 6 files changed, 90 insertions(+), 20 deletions(-) create mode 100644 docs/public/install diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 37a94cc..10d80c9 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -5,11 +5,20 @@ // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile "image": "mcr.microsoft.com/devcontainers/typescript-node:1-22-bookworm", "features": { - "ghcr.io/mpriscella/features/sops:1": {}, - "ghcr.io/eitsupi/devcontainer-features/go-task:1": {}, - "ghcr.io/astronomer/devcontainer-features/astro-cli:1": {}, + "ghcr.io/mpriscella/features/sops:1": { + "version": "latest" + }, + "ghcr.io/eitsupi/devcontainer-features/go-task:1": { + "version": "latest" + }, + "ghcr.io/astronomer/devcontainer-features/astro-cli:1": { + "version": "latest" + }, "ghcr.io/trunk-io/devcontainer-feature/trunk:1": {}, - "ghcr.io/itsmechlark/features/1password:1": {} + "ghcr.io/itsmechlark/features/1password:1": { + "version": "latest" + }, + "ghcr.io/michidk/devcontainers-features/bun:1": {} } // Use 'forwardPorts' to make a list of ports inside the container available locally. diff --git a/.github/workflows/docs-deploy.yaml b/.github/workflows/docs-deploy.yaml index b7f37da..3a309e7 100644 --- a/.github/workflows/docs-deploy.yaml +++ b/.github/workflows/docs-deploy.yaml @@ -5,6 +5,8 @@ on: push: branches: - main + paths: + - 'docs/**' jobs: build: @@ -17,22 +19,20 @@ jobs: - uses: actions/checkout@v4 with: fetch-depth: 0 - - uses: actions/setup-node@v4 - with: - node-version: 22 - cache: npm - cache-dependency-path: ./docs/package-lock.json + + - name: Setup Bun + uses: oven-sh/setup-bun@v2 - name: Install dependencies - run: npm ci + run: bun install - name: Build website - run: npm run build + run: bun run build - name: Upload Build Artifact uses: actions/upload-pages-artifact@v3 with: - path: docs/build + path: docs/dist deploy: name: Deploy to GitHub Pages diff --git a/.github/workflows/docs-test-deploy.yaml b/.github/workflows/docs-test-deploy.yaml index a4b2cc1..da65e5d 100644 --- a/.github/workflows/docs-test-deploy.yaml +++ b/.github/workflows/docs-test-deploy.yaml @@ -5,6 +5,8 @@ on: pull_request: branches: - main + paths: + - 'docs/**' jobs: test-deploy: @@ -19,13 +21,11 @@ jobs: with: fetch-depth: 0 - - uses: actions/setup-node@v4 - with: - node-version: 18 - cache: npm + - name: Setup Bun + uses: oven-sh/setup-bun@v2 - name: Install dependencies - run: npm ci + run: bun install - name: Test build website - run: npm run build + run: bun run build diff --git a/.trunk/configs/.yamllint.yaml b/.trunk/configs/.yamllint.yaml index 9f61395..0d56aaf 100644 --- a/.trunk/configs/.yamllint.yaml +++ b/.trunk/configs/.yamllint.yaml @@ -47,4 +47,4 @@ rules: trailing-spaces: enable truthy: level: warning - allowed-values: ["true", "false", "on"] + allowed-values: ["true", "false", "on", "off", "yes", "no"] diff --git a/docs/public/install b/docs/public/install new file mode 100644 index 0000000..9f755cd --- /dev/null +++ b/docs/public/install @@ -0,0 +1,61 @@ +#!/usr/bin/env zsh + +# ----------------------------------- +# author: @kiliantyler +# title: Dotfiles Installation Script +# description: Installs Xcode Command Line Tools if they are not already installed, +# then installs Chezmoi and initializes it with my dotfiles. +# ----------------------------------- + +fail() { + echo "$1" >&2 + exit 1 +} + +# ----------------------------------- +# Ensure we are running in zsh +# Make this check POSIX compliant +# ----------------------------------- + +if [ -z "${ZSH_VERSION:-}" ]; then + fail "Please run this script in zsh" +fi + +should_install_command_line_tools() { + ! [[ -e "/Library/Developer/CommandLineTools/usr/bin/git" ]] +} + +chomp() { + printf "%s" "${1/"$'\n'"/}" +} + +# ----------------------------------- +# Xcode Command Line Tools Installation +# ----------------------------------- + +if should_install_command_line_tools; then + echo "Installing Xcode Command Line Tools" + # This temporary file prompts the 'softwareupdate' utility to list the Command Line Tools + clt_placeholder="/tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress" + command sudo touch "${clt_placeholder}" + + clt_label_command="/usr/sbin/softwareupdate -l | + grep -B 1 -E 'Command Line Tools' | + awk -F'*' '/^ *\\*/ {print \$2}' | + sed -e 's/^ *Label: //' -e 's/^ *//' | + sort -V | + tail -n1" + clt_label="$(chomp "$(/bin/bash -c "${clt_label_command}")")" + + if [[ -n ${clt_label} ]]; then + command sudo "/usr/sbin/softwareupdate" "-i" "${clt_label}" + command sudo "/usr/bin/xcode-select" "--switch" "/Library/Developer/CommandLineTools" + fi + command sudo "/bin/rm" "-f" "${clt_placeholder}" +fi + +# ----------------------------------- +# Chezmoi Installation and Initialization +# ----------------------------------- + +sh -c "$(curl -fsLS get.chezmoi.io)" -- -b $HOME/.local/bin init --apply kiliantyler diff --git a/dotfiles/.chezmoiscripts/runOnce/run_once_before_0-decrypt_age_key.sh.tmpl b/dotfiles/.chezmoiscripts/runOnce/run_once_before_0-decrypt_age_key.sh.tmpl index 0842793..99ab428 100644 --- a/dotfiles/.chezmoiscripts/runOnce/run_once_before_0-decrypt_age_key.sh.tmpl +++ b/dotfiles/.chezmoiscripts/runOnce/run_once_before_0-decrypt_age_key.sh.tmpl @@ -8,6 +8,6 @@ if [ ! -f "${HOME}/.config/chezmoi/key.txt" ]; then mkdir -p "${HOME}/.config/chezmoi" - chezmoi age decrypt --output "${HOME}/.config/chezmoi/key.txt" --passphrase "{{ .chezmoi.sourceDir }}/key.txt.age" + $HOME/.local/bin/chezmoi age decrypt --output "${HOME}/.config/chezmoi/key.txt" --passphrase "{{ .chezmoi.sourceDir }}/key.txt.age" chmod 600 "${HOME}/.config/chezmoi/key.txt" fi