GITHUB_TOKEN no longer pushes anything in this workflow. PR runs are read-only, and main pushes go through the paseo-ai App token. The workflow-level 'contents: read' is sufficient. Addresses #365.
78 lines
2.2 KiB
YAML
78 lines
2.2 KiB
YAML
name: Nix Build
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
paths:
|
|
- "nix/**"
|
|
- "flake.nix"
|
|
- "flake.lock"
|
|
- "package.json"
|
|
- "package-lock.json"
|
|
- "packages/highlight/**"
|
|
- "packages/server/**"
|
|
- "packages/relay/**"
|
|
- "packages/cli/**"
|
|
- "scripts/update-nix.sh"
|
|
- "scripts/fix-lockfile.mjs"
|
|
- ".github/workflows/nix-build.yml"
|
|
pull_request:
|
|
branches: [main]
|
|
paths:
|
|
- "nix/**"
|
|
- "flake.nix"
|
|
- "flake.lock"
|
|
- "package.json"
|
|
- "package-lock.json"
|
|
- "packages/highlight/**"
|
|
- "packages/server/**"
|
|
- "packages/relay/**"
|
|
- "packages/cli/**"
|
|
- "scripts/update-nix.sh"
|
|
- "scripts/fix-lockfile.mjs"
|
|
- ".github/workflows/nix-build.yml"
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/create-github-app-token@v1
|
|
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
|
id: app-token
|
|
with:
|
|
app-id: ${{ secrets.PASEO_BOT_APP_ID }}
|
|
private-key: ${{ secrets.PASEO_BOT_APP_PRIVATE_KEY }}
|
|
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
ref: ${{ github.event.pull_request.head.sha || github.ref }}
|
|
token: ${{ steps.app-token.outputs.token || github.token }}
|
|
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: "22"
|
|
cache: "npm"
|
|
|
|
- uses: cachix/install-nix-action@v31
|
|
with:
|
|
nix_path: nixpkgs=channel:nixos-unstable
|
|
|
|
- name: Update lockfile + Nix hash if stale
|
|
run: ./scripts/update-nix.sh
|
|
|
|
- name: Build Nix package
|
|
run: nix build .#default -o result
|
|
|
|
- name: Commit hash/lockfile updates (main push only)
|
|
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
|
run: |
|
|
git diff --quiet package-lock.json nix/npm-deps.hash && exit 0
|
|
git config user.name "paseo-ai[bot]"
|
|
git config user.email "266920839+paseo-ai[bot]@users.noreply.github.com"
|
|
git add package-lock.json nix/npm-deps.hash
|
|
git commit -m "fix: update lockfile signatures and Nix hash [skip ci]"
|
|
git push
|