Files
blekin/.gitea/workflows/publish.yml
rob thijssen 99e337d387
Some checks failed
Publish / backend (push) Waiting to run
CI / fmt (push) Successful in 36s
Publish / frontend (push) Failing after 39s
CI / check (push) Successful in 1m31s
CI / clippy (push) Successful in 1m36s
ci: debug ssh
2026-05-06 17:35:30 +03:00

65 lines
2.4 KiB
YAML

name: Publish
on:
push:
branches: [main]
jobs:
frontend:
runs-on: rust
steps:
- uses: actions/checkout@v4
- name: Build frontend
run: |
cd crates/ericrfb-frontend
npm ci
npm run build
- name: Set up SSH
run: |
mkdir -p ~/.ssh
echo "${{ secrets.PUBLISH_KEY }}" > ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519
ssh-keyscan -H ${{ vars.UI_HOST }} >> ~/.ssh/known_hosts 2>/dev/null
- name: Deploy static files to UI host
run: |
rsync --archive --compress --verbose --delete dist/ gitea_ci@${{ vars.UI_HOST }}:${{ vars.UI_PATH }}/
- name: Deploy nginx config and reload
run: |
rsync --archive --compress --verbose --rsync-path 'sudo rsync' asset/nginx/blekin.kosherinata.internal.conf gitea_ci@${{ vars.UI_HOST }}:/etc/nginx/sites-available/blekin.kosherinata.internal.conf
ssh gitea_ci@${{ vars.UI_HOST }} 'sudo /usr/bin/ln -sf /etc/nginx/sites-available/blekin.kosherinata.internal.conf /etc/nginx/sites-enabled/blekin.kosherinata.internal.conf && sudo /usr/bin/nginx -t && sudo /usr/bin/systemctl reload nginx.service'
backend:
runs-on: rust
steps:
- uses: actions/checkout@v4
- name: Build release binary
run: cargo build --release -p ericrfb-proxy
- name: SSH init
run: |
mkdir -p ~/.ssh
echo "${{ secrets.PUBLISH_KEY }}" > ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519
ssh -o StrictHostKeyChecking=accept-new gitea_ci@${{ vars.WS_HOST }} exit
- name: Stop service
run: |
ssh gitea_ci@${{ vars.WS_HOST }} 'if systemctl is-active --quiet blekin.service; then sudo /usr/bin/systemctl stop blekin.service; fi'
- name: Deploy binary
run: |
rsync --archive --compress --verbose --rsync-path 'sudo rsync' target/release/ericrfb-proxy gitea_ci@${{ vars.WS_HOST }}:/usr/local/bin/ericrfb-proxy
- name: Deploy systemd unit
run: |
rsync --archive --compress --verbose --rsync-path 'sudo rsync' asset/systemd/blekin.service gitea_ci@${{ vars.WS_HOST }}:/etc/systemd/system/blekin.service
- name: Start and enable service
run: |
ssh gitea_ci@${{ vars.WS_HOST }} 'sudo /usr/bin/systemctl start blekin.service && ( systemctl is-enabled --quiet blekin.service || sudo /usr/bin/systemctl enable blekin.service )'