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
|
||||
|
||||
on:
|
||||
push:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
|
|
@ -8,14 +9,11 @@ jobs:
|
|||
name: Check flake
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- uses: cachix/install-nix-action@v17
|
||||
with:
|
||||
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
|
||||
- uses: cachix/install-nix-action@v31
|
||||
- uses: cachix/cachix-action@v14
|
||||
with:
|
||||
name: lava
|
||||
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
|
||||
|
|
@ -25,14 +23,11 @@ jobs:
|
|||
name: Build linux-lava for x86_64-linux
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- uses: cachix/install-nix-action@v17
|
||||
with:
|
||||
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
|
||||
- uses: cachix/install-nix-action@v31
|
||||
- uses: cachix/cachix-action@v14
|
||||
with:
|
||||
name: lava
|
||||
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue