-
Notifications
You must be signed in to change notification settings - Fork 34
78 lines (73 loc) · 2.48 KB
/
nixpkgs-bump.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
name: Bump nixpkgs
on:
schedule:
- cron: '47 6 * * *'
workflow_dispatch:
repository_dispatch:
types: [nixpkgs-update]
permissions:
contents: write
actions: write
concurrency:
group: nyx-main-bump
cancel-in-progress: true
jobs:
bump:
runs-on: ubuntu-latest
steps:
- name: Install Nix
uses: cachix/install-nix-action@v26
with:
extra_nix_config: |
accept-flake-config = true
system-features = big-parallel gccarch-x86-64-v3
install_url: https://releases.nixos.org/nix/nix-2.20.5/install
- uses: actions/checkout@v4
- name: Update nixpkgs flake
run: nix flake lock --update-input nixpkgs || exit 1; git diff --exit-code flake.lock && exit 1 || exit 0
continue-on-error: true
id: bump
- name: Commit nixpkgs bump
id: commit
if: steps.bump.outcome == 'success'
run: |
set -e
git config --global user.name 'Chaotic Github Actions'
git config --global user.email 'actions@chaotic.cx'
git add flake.lock
git commit -m "nixpkgs: bump to $(date +%Y%m%d)"
git push
COMMIT_HASH="$(git rev-parse HEAD)"
echo "COMMIT_HASH=$COMMIT_HASH" >> $GITHUB_OUTPUT
# Trigger build.yml and make sure no new commits were pushed in the meantime
- name: Trigger build.yml workflow
if: (success() && steps.bump.outcome == 'success')
uses: actions/github-script@v7
with:
script: |
try {
var comparison = await github.rest.repos.compareCommits({
owner: context.repo.owner,
repo: context.repo.repo,
base: process.env.COMMIT_HASH,
head: process.env.REF_NAME,
});
if (comparison.data.status != 'identical') {
core.setFailed('Skipping build because unknown commits were pushed');
return;
}
github.rest.actions.createWorkflowDispatch({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: 'build.yml',
ref: process.env.REF_NAME,
inputs: {
"nixpkgs-bump": true
}
});
} catch (error) {
core.setFailed(error);
}
env:
COMMIT_HASH: ${{ steps.commit.outputs.COMMIT_HASH }}
REF_NAME: ${{ github.ref_name }}