Skip to content

Commit

Permalink
update.sh: port to nushell, move git push into script
Browse files Browse the repository at this point in the history
  • Loading branch information
colemickens committed Sep 26, 2023
1 parent 201d737 commit 49d8153
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 57 deletions.
12 changes: 5 additions & 7 deletions .github/workflows/update.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ jobs:
github_access_token: ${{ secrets.GITHUB_TOKEN }}
extra_nix_config: |
system-features = kvm nixos-test
experimental-features = nix-command flakes
- uses: cachix/cachix-action@v12
with:
name: nixpkgs-wayland
Expand All @@ -26,13 +27,10 @@ jobs:
run: |
git config --global user.name 'Cole Botkens'
git config --global user.email '[email protected]'
- name: pre-load-devshell
run: |
nix build '.#devShell.x86_64-linux.default'
- name: update
env:
CACHIX_SIGNING_KEY: "${{ secrets.cachix_key_nixpkgs_wayland }}"
run: |
set -xeuo pipefail
nix develop -c nix flake update --commit-lock-file
nix develop -c ./update.sh
- name: push
run: |
git push origin HEAD
nix develop -c ./update.nu
1 change: 1 addition & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
git
jq
mercurial
nushell
openssh
ripgrep
])
Expand Down
47 changes: 47 additions & 0 deletions update.nu
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/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)"

return $"firefox-nightly-bin: ($oldversion) -> ($newversion)"
}
print -e "::endgroup::"

print -e $"::group::nix-flake-check"
do {
nix flake check -j1 -L
}
print -e $"::endgroup::"

print -e $"::group::git-commit-push"
if ("GITHUB_ACTIONS" in $env) {
print -e $"::notice ::commitmsg=($commitmsg)"
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::"
50 changes: 0 additions & 50 deletions update.sh

This file was deleted.

0 comments on commit 49d8153

Please sign in to comment.