fix(release): don't let the hook's GIT_DIR leak into release-assets #43
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| lint: | |
| name: Lint & Validate | |
| strategy: | |
| matrix: | |
| os: [macos-14, macos-latest] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Install ShellCheck & bash 4+ | |
| run: brew install shellcheck bash | |
| - name: ShellCheck | |
| run: | | |
| # .githooks scripts have no .sh extension — list them explicitly so | |
| # the release-critical scripts don't dodge the linter. | |
| { find . -name "*.sh" -not -path "./.git/*"; \ | |
| printf '%s\n' .githooks/pre-push .githooks/publish; } | while read -r file; do | |
| echo "Checking $file" | |
| shellcheck -x -s bash -e SC2034,SC1091,SC2016,SC2024 "$file" || exit 1 | |
| done | |
| - name: Bash syntax | |
| run: | | |
| { find . -name "*.sh" -not -path "./.git/*"; \ | |
| printf '%s\n' .githooks/pre-push .githooks/publish; } | while read -r file; do | |
| echo "Validating $file" | |
| bash -n "$file" || exit 1 | |
| done | |
| - name: Tests | |
| run: bash tests/run.sh | |
| - name: Plugin manifest lint | |
| run: | | |
| for p in tests/fixtures/*/; do | |
| [ -f "$p/plugin.json" ] || continue | |
| echo "Linting $p" | |
| bash macrift.sh plugin lint "$p" || exit 1 | |
| done | |
| - name: Manifest apply (dry-run, all kinds) | |
| run: MACRIFT_NO_UPDATE=true bash macrift.sh apply tests/fixtures/manifests/all-kinds.json --dry-run | |
| - name: Brewfile syntax | |
| run: | | |
| for bf in config/Brewfile.*; do | |
| [ -f "$bf" ] || continue | |
| echo "Validating $bf" | |
| grep -vE '^\s*(#|$|brew |cask |tap |mas )' "$bf" && exit 1 || true | |
| done | |
| - name: Config files exist | |
| run: | | |
| for f in config/Brewfile.dev config/Brewfile.browsers config/Brewfile.utils \ | |
| config/Brewfile.media config/Brewfile.comm config/Brewfile.fonts \ | |
| config/Brewfile.games config/Brewfile.appstore config/shell/.zshrc \ | |
| config/shell/config.jsonc config/ghostty/config \ | |
| config/vscode/settings.json; do | |
| [ -f "$f" ] && echo "OK: $f" || { echo "MISSING: $f"; exit 1; } | |
| done | |
| - name: Homebrew formula lint | |
| run: | | |
| # brew style only runs inside a tap — render the template into a | |
| # throwaway tap with dummy url/sha and lint it there. | |
| tap="$(brew --repository)/Library/Taps/emylfy/homebrew-citest" | |
| mkdir -p "$tap/Formula" | |
| sed -e 's|@URL@|https://example.com/macrift-0.0.0.tar.gz|' \ | |
| -e 's|@SHA256@|0000000000000000000000000000000000000000000000000000000000000000|' \ | |
| packaging/homebrew/macrift.rb.tmpl > "$tap/Formula/macrift.rb" | |
| git -C "$tap" init -q | |
| git -C "$tap" add -A | |
| git -C "$tap" -c user.email=ci@example.com -c user.name=ci commit -qm init | |
| brew style emylfy/citest/macrift |