nix/.forgejo/workflows/ssh-test.yml

83 lines
2.4 KiB
YAML
Raw Normal View History

2023-12-08 12:04:16 +01:00
name: ssh-test
run-name: ${{ github.actor }} - ssh-test
2023-12-08 12:04:24 +01:00
on:
push:
branches:
- main
2023-12-08 12:04:16 +01:00
jobs:
ssh-test:
2024-02-05 04:45:50 +01:00
runs-on: alpine
2023-12-08 12:04:16 +01:00
container:
image: alpine:edge
2023-12-08 14:09:45 +01:00
options: --mount type=bind,src=/dev/net/tun,dst=/dev/net/tun --privileged
2023-12-08 12:04:16 +01:00
steps:
2023-12-08 13:50:35 +01:00
- name: "Runner: Info"
run: |
2024-01-10 02:38:04 +01:00
set -x
2023-12-08 13:50:35 +01:00
pwd
ls -lah
id
uname -a
hostname
cat /etc/os-release
whoami
2023-12-08 13:51:34 +01:00
id
2023-12-08 13:50:35 +01:00
cat /etc/resolv.conf
2023-12-08 12:04:16 +01:00
- name: "Setup: Runner"
run: |
apk update
2023-12-08 14:00:44 +01:00
apk add git nodejs nix openssh-client qemu tailscale sudo --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing/
2023-12-08 12:41:38 +01:00
- name: "Setup: SSH"
run: |
mkdir /root/.ssh
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 644 /root/.ssh/id_ed25519.pub
2023-12-08 13:52:01 +01:00
echo "Public Key: "
cat /root/.ssh/id_ed25519.pub
2023-12-08 12:41:38 +01:00
- name: "Setup: Headscale"
run: |
2023-12-08 13:16:13 +01:00
echo "tailscaled --cleanup"
2023-12-08 14:00:13 +01:00
sudo tailscaled --cleanup
2023-12-08 13:16:13 +01:00
echo ""
2023-12-08 13:32:18 +01:00
echo "tailscaled --state=mem 2> ~/tailscaled.log &"
2023-12-08 14:00:13 +01:00
sudo tailscaled --state=mem: 2> ~/tailscaled.log &
2023-12-08 13:16:13 +01:00
echo ""
echo "tailscale up"
2023-12-08 14:00:13 +01:00
sudo tailscale up \
2023-12-08 13:11:42 +01:00
--login-server=https://headscale.sysctl.io \
--accept-routes \
--accept-dns \
--authkey ${{ secrets.TAILSCALE_KEY }} \
--hostname forgejo-runner \
--advertise-tags "tag:forgejo,tag:container,tag:ephemeral"
2023-12-08 14:00:13 +01:00
sudo tailscale status
sudo tailscale netcheck
2023-12-08 12:41:38 +01:00
2023-12-08 12:04:16 +01:00
- uses: actions/checkout@v3
- name: "Directory Structure"
run: |
ls ${{ github.workspace }}/*
2023-12-08 12:41:38 +01:00
2023-12-08 12:04:16 +01:00
- name: "Nix Version"
run: |
nix --version
- if: always()
2023-12-20 13:58:00 +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:39:06 +01:00
notification_title: '[ ${{ github.repository }}: ${{ github.workflow }} ] Build Complete'
2023-12-20 14:36:51 +01:00
notification_message: 'Your build has completed.'
2023-12-20 14:02:59 +01:00
name: "Send Notification"
- if: always()
2023-12-08 12:04:16 +01:00
run: rm -rf /.cache
- if: always()
run: rm -rf ${{ github.worksspace }}