Update workflows

This commit is contained in:
albert 2025-02-06 07:55:54 -08:00
parent 4e721b9928
commit c7fbbcab5e
Signed by: albert
GPG key ID: 3895DD267CA11BA9
2 changed files with 27 additions and 53 deletions

View file

@ -60,45 +60,4 @@ jobs:
Repo: ${{ github.repository }}
Status: ${{ job.status }}
Commit: ${{ github.sha }}
steamdeck:
runs-on: forgejo
container:
image: git.sysctl.io/albert/actions-images/nixos:latest
options: --mount type=bind,src=/dev/net/tun,dst=/dev/net/tun --privileged
steps:
- name: Add Gotify to Hosts
run: echo "100.64.0.5 gotify.sysctl.io" >> /etc/hosts
- name: Install SSH Keys
run: |
echo "${{ secrets.SSH_PRIVATE_KEY }}" > /root/.ssh/id_ed25519
chmod 700 /root/.ssh
chmod 600 /root/.ssh/id_ed25519
- name: Start Tailscale Daemon
run: |
tailscaled --no-logs-no-support --state=mem: &
- name: Connect to Headscale Network
run: |
tailscale up ${{ env.TS_OPTS }} --authkey ${{ secrets.TAILSCALE_KEY }}
tailscale status
- name: Update Repository
run: ssh ${{ env.SSH_OPTS }} albert@steamdeck.albert.hs.net "git -C /etc/nixos/git pull"
- name: NixOS Version (Pre)
run: ssh ${{ env.SSH_OPTS }} albert@steamdeck.albert.hs.net "nixos-version"
- name: Update NixOS
run: ssh ${{ env.SSH_OPTS }} albert@steamdeck.albert.hs.net "sudo nixos-rebuild switch --flake /etc/nixos/git"
- name: Update Home Manager
run: ssh ${{ env.SSH_OPTS }} albert@steamdeck.albert.hs.net "home-manager switch -b backup --flake /etc/nixos/git"
- name: NixOS Version (Post)
run: ssh ${{ env.SSH_OPTS }} albert@steamdeck.albert.hs.net "nixos-version"
- name: Send Notification
uses: actions/gotify-action@master
if: always()
with:
gotify_api_base: ${{ secrets.GOTIFY_URL }}
gotify_app_token: ${{ secrets.GOTIFY_TOKEN }}
notification_title: |
${{ github.workflow }}: ${{ job.status }}
notification_message: |
Repo: ${{ github.repository }}
Status: ${{ job.status }}
Commit: ${{ github.sha }}

View file

@ -6,26 +6,41 @@ on:
workflow_dispatch: # allows manual triggering
schedule:
- cron: '0 0 * * 0' # runs weekly on Sunday at 00:00
env:
SSH_HOST: "albert@steamdeck.albert.hs.net"
SSH_OPTS: "-q -A -o StrictHostKeyChecking=no"
TS_OPTS: "--login-server=https://headscale.sysctl.io --accept-routes --accept-dns --hostname forgejo-runner"
jobs:
steamdeck:
runs-on: forgejo
container:
image: git.sysctl.io/albert/actions-images/node:latest
image: git.sysctl.io/albert/actions-images/nixos:latest
options: --mount type=bind,src=/dev/net/tun,dst=/dev/net/tun --privileged
steps:
- name: Add Gotify to Hosts
run: echo "100.64.0.5 gotify.sysctl.io" >> /etc/hosts
- name: Set up SSH Keys
run: echo "${{ secrets.SSH_PRIVATE_KEY }}" > /root/.ssh/id_ed25519
- name: Setup Node
uses: actions/setup-node@v4
- name: Install SSH Keys
run: |
echo "${{ secrets.SSH_PRIVATE_KEY }}" > /root/.ssh/id_ed25519
chmod 700 /root/.ssh
chmod 600 /root/.ssh/id_ed25519
- name: Start Tailscale Daemon
run: |
tailscaled --no-logs-no-support --state=mem: &
- name: Connect to Headscale Network
run: |
tailscale up ${{ env.TS_OPTS }} --authkey ${{ secrets.TAILSCALE_KEY }}
tailscale status
- name: Update Repository
run: ssh -q -A albert@steamdeck.albert.hs.net "git -C /etc/nixos/git pull"
- run: ssh -qA -o StrictHostKeyChecking=no albert@steamdeck.albert.hs.net "nixos-version"
run: ssh ${{ env.SSH_OPTS }} ${{ SSH_HOST }} "git -C /etc/nixos/git pull"
- name: NixOS Version (Pre)
run: ssh ${{ env.SSH_OPTS }} ${{ SSH_HOST }} "nixos-version"
- name: Update NixOS
run: ssh -qA -o StrictHostKeyChecking=no albert@steamdeck.albert.hs.net "sudo nixos-rebuild switch --flake /etc/nixos/git"
- name: Update Home Manager
run: ssh -qA -o StrictHostKeyChecking=no albert@steamdeck.albert.hs.net "home-manager switch -b backup --flake /etc/nixos/git"
- run: ssh -qA -o StrictHostKeyChecking=no albert@steamdeck.albert.hs.net "nixos-version"
run: ssh ${{ env.SSH_OPTS }} ${{ SSH_HOST }} "sudo nixos-rebuild switch --flake /etc/nixos/git"
- name: Update Home Manager
run: ssh ${{ env.SSH_OPTS }} ${{ SSH_HOST }} "home-manager switch -b backup --flake /etc/nixos/git"
- name: NixOS Version (Post)
run: ssh ${{ env.SSH_OPTS }} ${{ SSH_HOST }} "nixos-version"
- name: Send Notification
uses: actions/gotify-action@master
if: always()