workflow: update, and add update script
This commit is contained in:
parent
cc835da43c
commit
09041e2ec8
3 changed files with 87 additions and 12 deletions
48
.github/workflows/autoupdate.yml
vendored
Normal file
48
.github/workflows/autoupdate.yml
vendored
Normal file
|
|
@ -0,0 +1,48 @@
|
||||||
|
name: Auto update
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
schedule:
|
||||||
|
- cron: "0 0 * * *"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
update:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Check for updates
|
||||||
|
id: check
|
||||||
|
run: |
|
||||||
|
local=$(cat flake.lock | jq ".nodes.nixpkgs.locked.rev")
|
||||||
|
remote=$(curl "https://api.github.com/repos/NixOS/nixpkgs/branches/nixos-unstable/commits?per_page=1" | jq ".commit.sha")
|
||||||
|
if [[ $local == $remote ]]; then
|
||||||
|
echo "skip=1" >> "$GITHUB_OUTPUT"
|
||||||
|
else
|
||||||
|
echo "skip=0" >> "$GITHUB_OUTPUT"
|
||||||
|
branch=$(TZ='Australia/Melbourne' date '+staging_auto/%Y%m%d')
|
||||||
|
echo "branch_name=${branch}" >> "$GITHUB_OUTPUT"
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Install nix
|
||||||
|
if: steps.check.outputs.skip == 0
|
||||||
|
uses: cachix/install-nix-action@v31
|
||||||
|
|
||||||
|
- name: Configure git
|
||||||
|
if: steps.check.outputs.skip == 0
|
||||||
|
run: |
|
||||||
|
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||||
|
git config --local user.name "github-actions[bot]"
|
||||||
|
|
||||||
|
- name: Update
|
||||||
|
if: steps.check.outputs.skip == 0
|
||||||
|
run: ./update.sh
|
||||||
|
|
||||||
|
- name: Push
|
||||||
|
if: steps.check.outputs.skip == 0
|
||||||
|
uses: ad-m/github-push-action@master
|
||||||
|
with:
|
||||||
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
branch: ${{ steps.check.outputs.branch_name }}
|
||||||
19
.github/workflows/cachix.yml
vendored
19
.github/workflows/cachix.yml
vendored
|
|
@ -1,6 +1,7 @@
|
||||||
name: CI
|
name: CI
|
||||||
|
|
||||||
on:
|
on:
|
||||||
|
push:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|
@ -8,14 +9,11 @@ jobs:
|
||||||
name: Check flake
|
name: Check flake
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- uses: cachix/install-nix-action@v17
|
- uses: cachix/install-nix-action@v31
|
||||||
with:
|
- uses: cachix/cachix-action@v14
|
||||||
install_url: https://github.com/numtide/nix-unstable-installer/releases/download/nix-2.12.0pre20220930_89ca75c/install
|
|
||||||
extra_nix_config: experimental-features = nix-command flakes
|
|
||||||
- uses: cachix/cachix-action@v10
|
|
||||||
with:
|
with:
|
||||||
name: lava
|
name: lava
|
||||||
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
|
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
|
||||||
|
|
@ -25,14 +23,11 @@ jobs:
|
||||||
name: Build linux-lava for x86_64-linux
|
name: Build linux-lava for x86_64-linux
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- uses: cachix/install-nix-action@v17
|
- uses: cachix/install-nix-action@v31
|
||||||
with:
|
- uses: cachix/cachix-action@v14
|
||||||
install_url: https://github.com/numtide/nix-unstable-installer/releases/download/nix-2.12.0pre20220930_89ca75c/install
|
|
||||||
extra_nix_config: experimental-features = nix-command flakes
|
|
||||||
- uses: cachix/cachix-action@v10
|
|
||||||
with:
|
with:
|
||||||
name: lava
|
name: lava
|
||||||
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
|
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
|
||||||
|
|
|
||||||
32
update.sh
Executable file
32
update.sh
Executable file
|
|
@ -0,0 +1,32 @@
|
||||||
|
#!/usr/bin/env -S nix shell 'nixpkgs#git' 'nixpkgs#curl' -c sh
|
||||||
|
|
||||||
|
update_kernel() {
|
||||||
|
previous_ver=$(cat packages/linux-lava/sources.nix | grep "version =" | sed --expression='s/[^0-9.]//g')
|
||||||
|
kernel_ver=$(curl -s https://www.kernel.org/finger_banner | grep -m1 stable | awk '{print $NF}')
|
||||||
|
|
||||||
|
if [ "$previous_ver" = "$kernel_ver" ]; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
kernel_major=$(cut -d '.' -f 1 <<< "$kernel_ver")
|
||||||
|
kernel_mmver=$(cut -d '.' -f 1,2 <<< "$kernel_ver")
|
||||||
|
|
||||||
|
hash_mm=$(nix-prefetch-url "https://cdn.kernel.org/pub/linux/kernel/v${kernel_major}.x/linux-${kernel_mmver}.tar.xz")
|
||||||
|
hash_patch=$(nix-prefetch-url "https://cdn.kernel.org/pub/linux/kernel/v${kernel_major}.x/patch-${kernel_ver}.xz")
|
||||||
|
|
||||||
|
sed -i "/version =/c\ version = \"${kernel_ver}\";" packages/linux-lava/sources.nix
|
||||||
|
sed -i "/kernelHash =/c\ kernelHash = \"${hash_mm}\";" packages/linux-lava/sources.nix
|
||||||
|
sed -i "/kernelPatchHash =/c\ kernelPatchHash = \"${hash_patch}\";" packages/linux-lava/sources.nix
|
||||||
|
|
||||||
|
git add packages/linux-lava/sources.nix
|
||||||
|
git commit -m "packages/linux-lava: bump to ${kernel_ver}"
|
||||||
|
}
|
||||||
|
|
||||||
|
bump_inputs() {
|
||||||
|
nix flake update
|
||||||
|
git add flake.lock
|
||||||
|
git commit -m "flake: bump inputs"
|
||||||
|
}
|
||||||
|
|
||||||
|
bump_inputs
|
||||||
|
update_kernel
|
||||||
Loading…
Add table
Add a link
Reference in a new issue