-
Notifications
You must be signed in to change notification settings - Fork 0
83 lines (70 loc) · 2.39 KB
/
pkgs.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
name: Packages
on:
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
jobs:
update:
name: Update
runs-on: ubuntu-latest
outputs:
changed: ${{ steps.update.outputs.changed }}
head: ${{ steps.stage.outputs.head }}
steps:
- uses: cachix/install-nix-action@v23
with:
extra_nix_config: |
system-features = benchmark big-parallel kvm nixos-test
- uses: actions/checkout@v4
with:
ssh-key: ${{ secrets.REPO_KEY }}
fetch-depth: 0
- name: Configure git
run: |
git config user.name 'github-actions[bot]'
git config user.email '41898282+github-actions[bot]@users.noreply.github.com'
- name: Configure $NIX_PATH
run: |
echo "NIX_PATH=nixpkgs=https://github.com/NixOS/nixpkgs/archive/$(jq -r '.nodes.nixpkgs.locked.rev' flake.lock).tar.gz" >> $GITHUB_ENV
- id: update
name: nix-shell scripts/update.nix --argstr commit true
run: |
echo | nix-shell scripts/update.nix --argstr commit true
if ! git diff --exit-code --quiet remotes/origin/${{ github.ref_name }}..; then
echo "changed=true" >> $GITHUB_OUTPUT
fi
- id: stage
name: Stage changes
if: steps.update.outputs.changed == 'true'
run: |
git push -f origin 'HEAD:ci/pkgs/${{ github.sha }}'
echo 'head=ci/pkgs/${{ github.sha }}' >> $GITHUB_OUTPUT
check:
name: Run Flake Checks
needs: [update]
if: needs.update.outputs.changed == 'true'
uses: ./.github/workflows/checks.yml
with:
ref_head: ${{ needs.update.outputs.head }}
secrets:
cachix_auth_token: ${{ secrets.CACHIX_AUTH_TOKEN }}
push:
name: Push
runs-on: ubuntu-latest
needs: [update, check]
if: needs.update.outputs.changed == 'true'
steps:
- uses: actions/checkout@v4
with:
ssh-key: ${{ secrets.REPO_KEY }}
fetch-depth: 0
ref: ${{ needs.update.outputs.head }}
- name: Configure git
run: |
git config user.name 'github-actions[bot]'
git config user.email '41898282+github-actions[bot]@users.noreply.github.com'
- name: Push changes
run: |
git pull --rebase origin '${{ github.ref }}'
git push origin 'HEAD:${{ github.ref }}'
git push origin -d '${{ needs.update.outputs.head }}'