diff --git a/.github/workflows/pr_chezmoi_init.yaml b/.github/workflows/pr_chezmoi_init.yaml index 92ac6883..11bb9be5 100644 --- a/.github/workflows/pr_chezmoi_init.yaml +++ b/.github/workflows/pr_chezmoi_init.yaml @@ -18,12 +18,18 @@ jobs: run: | echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT id: extract_branch - - name: Run chezmoi init in arch linux docker container + - name: Run chezmoi init in container uses: addnab/docker-run-action@v3 with: # https://github.com/scottames/boxes image: ghcr.io/scottames/fedora-toolbox:latest options: -v ${{ github.workspace }}:/home/container/src/scottames/dots + shell: fish run: | /home/container/src/scottames/dots/scripts/init.sh \ --no-tty --branch "${{ steps.extract_branch.outputs.branch }}" + - name: Capture chezmoi data + uses: actions/upload-artifact@v4 + with: + name: chezmoi-data + path: .chezmoi.json diff --git a/home/.chezmoi.toml.tmpl b/home/.chezmoi.toml.tmpl index 724a8c06..df25a343 100644 --- a/home/.chezmoi.toml.tmpl +++ b/home/.chezmoi.toml.tmpl @@ -7,8 +7,14 @@ {{ $desktopSession := env "DESKTOP_SESSION" -}} {{ $hourDark := 24 -}} {{ $hourLight := 24 -}} -{{ $osVariant := "" }} -{{ $ublueImageInfo := "" }} +{{ $osVariant := "" -}} +{{ $ublueImageInfo := "" -}} + +{{ $githubActions := or (env "GITHUB_ACTIONS") false -}} +{{ $isCI := false -}} +{{ if $githubActions -}} +{{ $isCI = true }} +{{ end -}} {{ $loginSession := 0 -}} {{ $loginSessionType := "" -}} @@ -58,6 +64,9 @@ progress = true hour_light = {{ $hourLight }} login_session = {{ $loginSession }} login_session_type = "{{ $loginSessionType }}" + [data.ci] + github_actions = {{ $githubActions }} + is_ci = {{ $isCI }} [data.host] chassis = "{{ $chassis }}" is_ublue = {{ $isUblue }} diff --git a/home/.chezmoiscripts/run_once_after_00-always.sh b/home/.chezmoiscripts/run_once_after_00-always.sh deleted file mode 100644 index d8a5e194..00000000 --- a/home/.chezmoiscripts/run_once_after_00-always.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/env sh - -yellow='\033[0;33m' -clear='\033[0m' - -warn() { - printf "${yellow}❕%s${clear}\n" "${@}" -} - -if [ ! -x "$(command -v fish)" ]; then - warn "fish not found." -fi diff --git a/home/.chezmoiscripts/run_once_after_00-always.sh.tmpl b/home/.chezmoiscripts/run_once_after_00-always.sh.tmpl new file mode 100644 index 00000000..d0ea1336 --- /dev/null +++ b/home/.chezmoiscripts/run_once_after_00-always.sh.tmpl @@ -0,0 +1,22 @@ +#!/bin/env sh + +yellow='\033[0;33m' +clear='\033[0m' + +warn() { + printf "${yellow}❕%s${clear}\n" "${@}" +} + +if [ ! -x "$(command -v fish)" ]; then + warn "fish not found." +fi + +# shellcheck disable=SC1056,SC1072,SC1083,SC1009,SC1073,SC1054 +{{ if .ci.is_ci -}} + +chezmoi data | tee "{{ .chezmoi.sourceDir }}/.chezmoi.json" + +# shellcheck disable=SC1056,SC1072,SC1083,SC1009,SC1073,SC1054 +{{ end -}} + +# vi: ft=sh diff --git a/home/.chezmoiscripts/run_once_after_20_distrobox.sh.tmpl b/home/.chezmoiscripts/run_once_after_20_distrobox.sh.tmpl index 01413758..9469a30b 100644 --- a/home/.chezmoiscripts/run_once_after_20_distrobox.sh.tmpl +++ b/home/.chezmoiscripts/run_once_after_20_distrobox.sh.tmpl @@ -15,18 +15,25 @@ clear='\033[0m' print_info() { printf "\n${yellow}⚡ ${magenta}%s${clear}" "${@}"; } print_success() { printf "\n${cyan}🎉 %s${clear}\n\n" "${@}"; } # print_err() { printf "\n${red}💥 %s${clear}\n\n" "${@}"; } -# print_warn() { printf "\n${yellow}⚠ %s${clear}\n\n" "${@}"; } +print_warn() { printf "\n${yellow}⚠ %s${clear}\n\n" "${@}"; } # https://patorjk.com/software/taag/#p=display&f=ANSI%20Shadow&t=distrobox echo ' ██████╗ ██╗███████╗████████╗██████╗ ██████╗ ██████╗ ██████╗ ██╗ ██╗ ██╔══██╗██║██╔════╝╚══██╔══╝██╔══██╗██╔═══██╗██╔══██╗██╔═══██╗╚██╗██╔╝ -██║ ██║██║███████╗ ██║ ██████╔╝██║ ██║██████╔╝██║ ██║ ╚███╔╝ -██║ ██║██║╚════██║ ██║ ██╔══██╗██║ ██║██╔══██╗██║ ██║ ██╔██╗ +██║ ██║██║███████╗ ██║ ██████╔╝██║ ██║██████╔╝██║ ██║ ╚███╔╝ +██║ ██║██║╚════██║ ██║ ██╔══██╗██║ ██║██╔══██╗██║ ██║ ██╔██╗ ██████╔╝██║███████║ ██║ ██║ ██║╚██████╔╝██████╔╝╚██████╔╝██╔╝ ██╗ ╚═════╝ ╚═╝╚══════╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝ ' +# shellcheck disable=SC1056,SC1072,SC1083,SC1009,SC1073,SC1054 +{{ if .ci.is_ci -}} + +print_warn "running in ci... skipping distrobox systemd oneshot setup" + +# shellcheck disable=SC1056,SC1072,SC1083,SC1009,SC1073,SC1054 +{{ else -}} # reload # {{ include "private_dot_config/distrobox/assemble.ini.tmpl" | sha256sum }} # {{ include "private_dot_config/systemd/user/distrobox-arch-oneshot.service.tmpl" | sha256sum }} @@ -49,4 +56,5 @@ for service in "${_services[@]}"; do fi done +{{ end -}} # vi: ft=bash