aria.coffee/.forgejo/workflows/deploy.yaml
aria a7bf919a3d
Some checks failed
Deploy to Web Server / deploy (push) Failing after 2m36s
Add tun device to fix tailsacled
2025-05-16 23:35:35 +10:00

77 lines
No EOL
2.3 KiB
YAML

name: Deploy to Web Server
on:
push:
branches:
- main
jobs:
deploy:
# runs-on: WebDeployment
runs-on: 9950x
container:
image: docker.io/node:23-bookworm
options: --cap-add=NET_ADMIN --device=/dev/net/tun
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install pnpm
uses: https://github.com/pnpm/action-setup@v4
with:
version: 10
- name: Install Node.js
uses: https://github.com/actions/setup-node@v4
with:
node-version: 23.11.0
cache: 'pnpm'
- name: Install SSH key
uses: https://github.com/shimataro/ssh-key-action@v2
with:
key: ${{ secrets.SSH_KEY }}
name: aria-coffee-deploy # optional
known_hosts: ${{ secrets.KNOWN_HOSTS }}
if_key_exists: fail
- run: pnpm install
- name: Build website
run: pnpm run build-action
- name: Install Sudo
run: |
apt-get update && apt-get -y install sudo
# - name: Sudo group
# run: |
# groupmod -a -U $USER sudo
- name: Setup Tailscale
uses: https://github.com/tailscale/github-action@v3
with:
authkey: ${{ secrets.TAILSCALE_AUTHKEY }}
- name: Create folder if not exists
continue-on-error: true
run: |
ssh -i ~/.ssh/aria-coffee-deploy ${{ vars.SERVER_USER }}@${{ vars.SERVER_HOST_TAILSCALE }} "mkdir -p /var/www/Aria/"
- name: Clear old backup
continue-on-error: true
run: |
ssh -i ~/.ssh/aria-coffee-deploy ${{ vars.SERVER_USER }}@${{ vars.SERVER_HOST_TAILSCALE }} "[ -d "/var/www/Aria/dist-old" ] && rm -r /var/www/Aria/dist-old"
- name: Backup current install
continue-on-error: true
run: |
ssh -i ~/.ssh/aria-coffee-deploy ${{ vars.SERVER_USER }}@${{ vars.SERVER_HOST_TAILSCALE }} "[ -d "/var/www/Aria/dist" ] && mv /var/www/Aria/dist /var/www/Aria/dist-old"
- name: Copy over new build-action
run: |
scp -i ~/.ssh/aria-coffee-deploy -rv ./dist ${{ vars.SERVER_USER }}@${{ vars.SERVER_HOST_TAILSCALE }}:/var/www/Aria
- name: Set permissions on the deployed files
run: |
ssh -i ~/.ssh/aria-coffee-deploy ${{ vars.SERVER_USER }}@${{ vars.SERVER_HOST_TAILSCALE }} "chmod -R 755 /var/www/Aria/dist"