generated from nix-community/nur-packages-template
-
Notifications
You must be signed in to change notification settings - Fork 5
89 lines (78 loc) · 2.71 KB
/
auto-update.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
84
85
86
87
88
89
name: 'Auto update packages'
on:
workflow_dispatch:
schedule:
- cron: '55 9 * * *'
jobs:
auto-update:
runs-on: ubuntu-latest
env:
GIT_SSL_NO_VERIFY: 'true'
steps:
- name: Maximize build space
uses: easimon/maximize-build-space@master
with:
root-reserve-mb: 512
swap-size-mb: 1024
build-mount-path: '/nix'
remove-dotnet: 'true'
remove-android: 'true'
remove-haskell: 'true'
remove-codeql: 'true'
remove-docker-images: 'true'
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up QEMU
id: qemu
uses: docker/setup-qemu-action@v3
with:
image: tonistiigi/binfmt:latest
platforms: all
- name: Install nix
uses: cachix/install-nix-action@v30
with:
extra_nix_config: |
experimental-features = nix-command flakes ca-derivations
extra-experimental-features = nix-command flakes ca-derivations
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
extra-platforms = i686-linux aarch64-linux arm-linux
log-lines = 25
- name: Set nix daemon tmpdir path
run: |
sudo mkdir -p /nix/tmpdir
sudo chown "$(whoami)" /nix/tmpdir
cat > override.conf <<EOF
[Service]
Environment="TMPDIR=/nix/tmpdir"
EOF
sudo mkdir /etc/systemd/system/nix-daemon.service.d/
sudo mv override.conf /etc/systemd/system/nix-daemon.service.d/override.conf
sudo systemctl daemon-reload
sudo systemctl restart nix-daemon
- name: Cache Nvfetcher Database
id: cache-nvfetcher
uses: actions/cache@v4
with:
path: ~/.local/share/nvfetcher
key: nvfetcher
- name: Build nix packages
run: |
cat > secrets.toml <<EOF
[keys]
github = "${{ secrets.GITHUB_TOKEN }}"
EOF
env TMPDIR=/nix/tmpdir nix run .#update
rm -f secrets.toml
- env:
API_TOKEN_GITHUB: ${{ secrets.AUTOMERGE_TOKEN }}
run: |
# https://github.com/cpina/github-action-push-to-another-repository/issues/75
git config --unset-all http.https://github.com/.extraheader
git config --global user.email "[email protected]"
git config --global user.name "xddxdd-bot"
git add .
if git commit -m "auto: update packages" ; then
git remote remove origin
git remote add origin "https://xddxdd-bot:[email protected]/xddxdd/nur-packages.git"
git push -u origin master --force
fi