nix/.forgejo/workflows/update-flake-lock.yml

65 lines
2 KiB
YAML
Raw Normal View History

2023-10-03 21:49:47 +09:00
name: update-flake-lock
run-name: ${{ github.actor }} - update-flake-lock
2023-11-30 15:01:52 +09:00
on:
2024-04-13 10:32:37 +09:00
schedule:
- cron: '0 0 * * *'
# “At 00:00 daily."
2024-02-05 13:30:33 +09:00
2023-10-02 19:08:16 +09:00
jobs:
2023-10-03 21:49:47 +09:00
update-flake-lock:
2024-02-05 13:30:33 +09:00
runs-on: ubuntu
2023-10-03 20:47:28 +09:00
container:
2024-02-05 14:01:06 +09:00
image: ubuntu:23.10
2023-10-02 19:08:16 +09:00
steps:
2023-10-03 20:53:46 +09:00
- name: "Setup Runner"
run: |
2024-02-05 13:30:33 +09:00
apt update -y
apt install git nodejs nix-bin -y
2023-10-04 09:51:24 +09:00
git config --global user.email "${{github.actor}}"
git config --global user.name "Albert J. Copeland"
2023-11-30 15:20:28 +09:00
- uses: actions/checkout@v3
2023-10-03 14:11:21 +09:00
- name: "Directory Structure"
2023-10-03 11:47:57 +09:00
run: |
2023-10-03 12:11:56 +09:00
ls ${{ github.workspace }}/*
2023-11-30 15:20:28 +09:00
- name: "Git Info"
run: |
git -C ${{ github.workspace }} status
git -C ${{ github.workspace }} log
git -C ${{ github.workspace }} diff
2023-10-03 19:42:17 +09:00
- name: "Runner: Node Info"
run: |
id
uname -a
hostname
2023-10-03 21:00:28 +09:00
cat /etc/os-release
2023-10-03 21:10:47 +09:00
- name: "Nix Version"
run: |
nix --version
2023-10-04 10:29:20 +09:00
- name: "Nix Flake Update"
2023-10-03 21:27:00 +09:00
run: |
2023-10-03 21:49:47 +09:00
echo "Running Nix Flake Update"
cd /workspace/albert/nix
2024-02-23 11:05:07 +09:00
git pull
2023-10-04 17:42:05 +09:00
nix --extra-experimental-features "nix-command flakes" flake update
2023-10-03 21:49:47 +09:00
echo "Git Diff:"
git diff
2023-10-04 17:42:05 +09:00
- name: "Commit and Upload"
run: |
2023-12-09 10:14:03 +09:00
git commit -am "[ACTIONS] Flake Update (`date +%Y-%m-%d`)"
2023-10-04 17:42:05 +09:00
git push
2023-10-04 09:42:45 +09:00
- if: success()
2023-12-20 22:21:52 +09:00
uses: https://git.sysctl.io/actions/gotify-action@master
with:
gotify_api_base: '${{ secrets.GOTIFY_URL }}'
gotify_app_token: '${{ secrets.GOTIFY_TOKEN }}'
2023-12-20 22:40:58 +09:00
notification_title: '[ ${{ github.repository }}: ${{ github.workflow }} ] NixOS Flake Updated'
2023-12-20 22:21:52 +09:00
notification_message: 'Build completed successfully.'
- if: failure()
uses: https://git.sysctl.io/actions/gotify-action@master
with:
gotify_api_base: '${{ secrets.GOTIFY_URL }}'
gotify_app_token: '${{ secrets.GOTIFY_TOKEN }}'
2023-12-20 22:40:58 +09:00
notification_title: '[ ${{ github.repository }}: ${{ github.workflow }} ] Build Failed'
2023-12-20 22:23:18 +09:00
notification_message: 'Your build has failed. Check Forgejo.'
2024-02-23 11:05:07 +09:00
name: "Send Notification"