generated from nix-community/nur-packages-template
-
Notifications
You must be signed in to change notification settings - Fork 0
77 lines (66 loc) · 2.3 KB
/
auto-update-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
75
76
77
name: auto-update-flake
on:
workflow_dispatch:
schedule:
# Nominally 06:11 GMT+3, but actual start times apparently suffer from delays
- cron: '11 3 * * *'
permissions: {}
defaults:
run:
shell: bash
env:
CI_NIX_INSTALL_URL: https://releases.nixos.org/nix/nix-2.18.1/install
NIX_CONFIG: access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
jobs:
setup:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.generate_matrix.outputs.matrix }}
steps:
- name: Checkout
uses: actions/[email protected]
- name: Install Nix
uses: cachix/install-nix-action@3715ab1a11cac9e991980d7b4a28d80c7ebdd8f9
with:
install_url: ${{ env.CI_NIX_INSTALL_URL }}
- name: Generate matrix from flake inputs
id: generate_matrix
run: |
# Generate matrix from flake inputs
matrix="$(nix flake metadata --json | jq -rcM '.locks.nodes.root.inputs | {input: keys}')"
printf 'matrix=%s\n' "$matrix" >> $GITHUB_OUTPUT
update:
needs:
- setup
runs-on: ubuntu-latest
strategy:
fail-fast: false
max-parallel: 1
matrix: ${{ fromJSON(needs.setup.outputs.matrix) }}
env:
automerge: ${{ (matrix.input == 'nixpkgs') || (matrix.input == 'nixos-unstable') }}
steps:
- name: Checkout
uses: actions/[email protected]
- name: Install Nix
uses: cachix/install-nix-action@3715ab1a11cac9e991980d7b4a28d80c7ebdd8f9
with:
install_url: ${{ env.CI_NIX_INSTALL_URL }}
nix_path: nixpkgs=channel:nixos-unstable
- name: Generate a GitHub token
id: token
uses: tibdex/[email protected]
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.APP_PRIVATE_KEY }}
- name: Update ${{ matrix.input }}
uses: cpcloud/[email protected]
with:
dependency: ${{ matrix.input }}
pull-request-token: ${{ steps.token.outputs.token }}
pull-request-author: "sigprof[bot] <108069352+sigprof[bot]@users.noreply.github.com>"
pull-request-labels: "autorebase:opt-in"
delete-branch: true
github-token: ${{ secrets.GITHUB_TOKEN }}
pull-request-branch-prefix: auto-update/flake/
automerge: ${{ env.automerge }}