nix-flake/.forgejo/workflows/activate.yml
satr14 e1d8f209bc
Some checks failed
Activate Homelab Configuration / rebuild (push) Failing after 2s
fix buttons
2026-06-17 19:00:27 +07:00

42 lines
No EOL
1.3 KiB
YAML

name: Activate Homelab Configuration
on:
workflow_dispatch:
push:
branches: [ main ]
env:
PATH: /run/current-system/sw/bin:/run/wrappers/bin
jobs:
rebuild:
runs-on: self-hosted
steps:
- name: Setup SSH key
run: |
mkdir -p ./ssh
echo "${{ secrets.DEPLOY_SSH_KEY }}" > ./ssh/deploy_key
chmod 600 ./ssh/deploy_key
- name: Rebuild and switch
run: |
ssh -i ./ssh/deploy_key \
-o PasswordAuthentication=no \
-o StrictHostKeyChecking=no \
-o UserKnownHostsFile=/dev/null \
root@localhost \
"bash -lc 'nixos-rebuild switch --refresh --flake git+http://localhost:5080/satr14/nix-flake#homelab -L'"
- name: Notify on failure
if: failure()
run: |
curl -s -X POST https://notify.proxy.satr14.my.id/git-flake-updates \
-H "Title: NixOS Homelab Rebuild Failed" \
-H "Priority: high" \
-H "Tags: x" \
-H "Actions: view, Action Runs, https://git.satr14.my.id/${{ github.repository }}/actions?workflow=activate.yml; view, View Commit, https://git.satr14.my.id/${{ github.repository }}/commit/${{ github.sha }}" \
-d "${{ github.event.head_commit.message }}"
- name: Clean Up
if: always()
run: rm -f ./ssh/deploy_key