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

63 lines
2 KiB
YAML
Raw Normal View History

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