-
Notifications
You must be signed in to change notification settings - Fork 0
74 lines (63 loc) · 2.08 KB
/
flake.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
name: Flake
on:
schedule:
- cron: '0 1 * * *'
workflow_dispatch:
jobs:
update:
name: Update
runs-on: ubuntu-latest
outputs:
changed: ${{ steps.commit.outputs.changed }}
head: ${{ steps.commit.outputs.head }}
steps:
- uses: DeterminateSystems/nix-installer-action@v16
with:
diagnostic-endpoint: ''
source-url: 'https://install.lix.systems/lix/lix-installer-x86_64-linux'
- uses: actions/checkout@v4
with:
ssh-key: ${{ secrets.REPO_KEY }}
- name: Configure git
run: |
git config user.name 'github-actions[bot]'
git config user.email '41898282+github-actions[bot]@users.noreply.github.com'
- run: nix -vL --show-trace flake update
- id: commit
name: Commit and stage changes
run: |
if ! git diff --exit-code --quiet flake.lock; then
git commit -m 'flake: update inputs' flake.lock
git push -f origin 'HEAD:ci/flake/${{ github.sha }}'
echo 'changed=true' >> $GITHUB_OUTPUT
echo 'head=ci/flake/${{ github.sha }}' >> $GITHUB_OUTPUT
fi
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: 2
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 }}'