-
Notifications
You must be signed in to change notification settings - Fork 7
/
update.nu
executable file
·58 lines (47 loc) · 1.48 KB
/
update.nu
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
#!/usr/bin/env nu
let DIR = ($env.FILE_PWD)
let cache = "nixpkgs-wayland"
print -e $"::group::flake-lock-update"
do {
nix flake lock --recreate-lock-file --commit-lock-file
}
print -e $"::endgroup::"
print -e $"::group::firefox-update"
let commitmsg = do {
let oldversion = (cat latest.json
| jq -r '.["x86_64-linux"].versionInfo["firefox-nightly-bin"].chksum'
| grep -Eo '[0-9]{4}-[0-9]{2}-[0-9]{2}-[0-9]{2}-[0-9]{2}-[0-9]{2}')
print -e $"::notice ::oldversion=($oldversion)"
rm latest.json
nix eval --impure '.#latest' --json | jq out> latest.json
let newversion = (cat latest.json
| jq -r '.["x86_64-linux"].versionInfo["firefox-nightly-bin"].chksum'
| grep -Eo '[0-9]{4}-[0-9]{2}-[0-9]{2}-[0-9]{2}-[0-9]{2}-[0-9]{2}')
print -e $"::notice ::newversion=($newversion)"
$"firefox-nightly-bin: ($oldversion) -> ($newversion)"
}
print -e "::endgroup::"
print -e $"::group::nix-build"
do {
nix build . --keep-going -L
}
print -e $"::endgroup::"
print -e $"::group::nix-flake-check"
try {
nix flake check --keep-going -j1 -L
print -e $"::notice ::nix flake check = pass"
} catch {
print -e $"::warning ::nix flake check = FAIL"
}
print -e $"::endgroup::"
print -e $"::group::git-commit-push"
if ("GITHUB_ACTIONS" in $env) {
print -e $"::notice ::commitmsg=($commitmsg)"
do -i {
git commit ./latest.json -m $commitmsg
git push origin HEAD
}
} else {
print -e $"skipping git actions, we're not running in GitHub Actions"
}
print -e $"::endgroup::"