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

65 lines
2.1 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:
2023-11-30 07:27:47 +01:00
schedule:
2023-12-17 14:36:44 +01:00
- cron: '0 0 * * 1'
# “At 00:00 on Monday."
2023-10-02 12:08:16 +02:00
jobs:
2023-10-03 14:49:47 +02:00
update-flake-lock:
2023-10-02 12:08:16 +02:00
runs-on: docker
2023-10-03 13:47:28 +02:00
container:
2023-10-03 14:07:16 +02:00
image: alpine:edge
2023-10-02 12:08:16 +02:00
steps:
2023-10-03 13:53:46 +02:00
- name: "Setup Runner"
run: |
apk update
2023-11-30 07:25:45 +01:00
apk add git nodejs nix --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing/
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 }}'
notification_title: 'NixOS Flake Updated'
notification_message: 'Build completed successfully.'
2023-10-03 07:20:25 +02:00
- if: always()
2023-10-03 07:46:16 +02:00
run: rm -rf /.cache
- if: always()
2023-12-20 14:21:52 +01:00
run: rm -rf ${{ github.worksspace }}
- if: failure()
uses: https://git.sysctl.io/actions/gotify-action@master
with:
gotify_api_base: '${{ secrets.GOTIFY_URL }}'
gotify_app_token: '${{ secrets.GOTIFY_TOKEN }}'
notification_title: 'Build Failed (${{ github.actor }})'
notification_message: 'Your build has failed. Check Forgejo.'