Update workflows

This commit is contained in:
albert 2024-09-03 21:40:50 +09:00
parent 821695dbe4
commit 0990eedc4f
Signed by: albert
GPG key ID: 3895DD267CA11BA9

View file

@ -8,7 +8,7 @@ on:
jobs:
deploy-rs:
runs-on: ubuntu
container:
container:
image: ubuntu:24.04
options: --mount type=bind,src=/dev/net/tun,dst=/dev/net/tun --privileged
steps:
@ -16,7 +16,7 @@ jobs:
run: |
set -x
pwd
ls -lah
ls -lah
id
uname -a
hostname
@ -25,8 +25,8 @@ jobs:
id
cat /etc/resolv.conf
- name: "Setup: Runner"
run: |
- name: "Setup: Runner"
run:
apt update -y
apt install git nodejs nix-bin sudo curl -y
git config --global user.email "${{github.actor}}"
@ -34,25 +34,25 @@ jobs:
echo "100.64.0.14 gotify.sysctl.io" >> /etc/hosts
- name: "Setup: Tailscale Repo"
run: |
run: |
mkdir -p --mode=0755 /usr/share/keyrings
curl -fsSL https://pkgs.tailscale.com/stable/ubuntu/lunar.noarmor.gpg | sudo tee /usr/share/keyrings/tailscale-archive-keyring.gpg >/dev/null
curl -fsSL https://pkgs.tailscale.com/stable/ubuntu/lunar.tailscale-keyring.list | sudo tee /etc/apt/sources.list.d/tailscale.list
apt update -y
apt install tailscale -y
- name: "Setup: SSH"
- name: "Setup: SSH"
run: |
rm -rf /root/.ssh
rm -rf /root/.ssh
mkdir /root/.ssh
echo "${{ secrets.SSH_PUBLIC_KEY }}" > /root/.ssh/id_ed25519.pub
echo "${{ secrets.SSH_PUBLIC_KEY }}" > /root/.ssh/id_ed25519.pub
echo "${{ secrets.SSH_PRIVATE_KEY }}" > /root/.ssh/id_ed25519
chmod 700 /root/.ssh
chmod 600 /root/.ssh/id_ed25519
chmod 600 /root/.ssh/id_ed25519
chmod 644 /root/.ssh/id_ed25519.pub
- name: "Setup: Headscale Network"
run: |
run: |
echo "tailscaled --cleanup"
sudo tailscaled --cleanup
echo ""
@ -67,21 +67,21 @@ jobs:
--authkey ${{ secrets.TAILSCALE_KEY }} \
--hostname forgejo-runner \
--advertise-tags "tag:forgejo,tag:container,tag:ephemeral"
sudo tailscale status
sudo tailscale status
sudo tailscale netcheck
- name: "nixos-version (Pre)"
run: |
run: |
ssh -q -A -o StrictHostKeyChecking=no albert@framework-server \
"
nixos-version
"
- name: "SSH and Deploy"
run: |
run: |
ssh -q -A -o StrictHostKeyChecking=no albert@framework-server \
"
set -x
set -x
eval (ssh-agent -c)
ssh-add
env | grep SSH
@ -95,7 +95,7 @@ jobs:
"
- name: "nixos-version (Post)"
run: |
run: |
ssh -q -A -o StrictHostKeyChecking=no albert@framework-server \
"
nixos-version
@ -103,18 +103,18 @@ jobs:
tailscale down
- if: success()
uses: https://git.sysctl.io/actions/gotify-action@master
uses: https://git.sysctl.io/actions/gotify-action@master
with:
gotify_api_base: '${{ secrets.GOTIFY_URL }}'
gotify_app_token: '${{ secrets.GOTIFY_TOKEN }}'
notification_title: '[ ${{ github.repository }}: ${{ github.workflow }} ] NixOS Deployed'
notification_message: 'Deployment completed successfully.'
name: "Send Notification - Success"
name: "Send Notification - Success"
- if: failure()
uses: https://git.sysctl.io/actions/gotify-action@master
uses: https://git.sysctl.io/actions/gotify-action@master
with:
gotify_api_base: '${{ secrets.GOTIFY_URL }}'
gotify_app_token: '${{ secrets.GOTIFY_TOKEN }}'
notification_title: '[ ${{ github.repository }}: ${{ github.workflow }} ] Deployment Failed'
notification_message: 'Your deployment has failed. Check Forgejo.'
name: "Send Notification - Failure"
name: "Send Notification - Failure"