Files
blekin/.gitea/workflows/publish.yml
rob thijssen ee4b0a2124
All checks were successful
CI / fmt (push) Successful in 38s
CI / check (push) Successful in 1m52s
CI / clippy (push) Successful in 1m51s
Publish / frontend (push) Successful in 37s
Publish / backend (push) Successful in 2m27s
ci: debug ssh
2026-05-06 18:38:50 +03:00

68 lines
2.6 KiB
YAML

name: Publish
on:
push:
branches: [main]
env:
PUBLISH_KEY: |
${{ secrets.PUBLISH_KEY }}
jobs:
frontend:
runs-on: rust
steps:
- uses: actions/checkout@v4
- name: Build frontend
run: |
cd crates/ericrfb-frontend
npm ci
npm run build
- name: SSH init
run: |
mkdir -p ~/.ssh
echo "${PUBLISH_KEY}" > ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519
ssh -o ConnectTimeout=5 -o StrictHostKeyChecking=accept-new gitea_ci@${{ vars.UI_HOST }} 'echo $(hostname -f) connection succeeded'
- 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 "${PUBLISH_KEY}" > ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519
ssh -v -o ConnectTimeout=5 -o StrictHostKeyChecking=accept-new gitea_ci@${{ vars.WS_HOST }} 'echo $(hostname -f) connection succeeded'
- 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 )'