Builds the Vite app, serves it via nginx in a Docker container, and deploys via SSH/SCP to racknerd1 on push to main. Also syncs the out-of-date package-lock.json so npm ci works in CI/Docker builds. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BbJV5nm8KPVH1oNJYKpnoF
39 lines
1,022 B
YAML
39 lines
1,022 B
YAML
name: Deploy to racknerd1
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
workflow_dispatch: {}
|
|
|
|
env:
|
|
DEPLOY_PATH: /opt/archnest
|
|
|
|
jobs:
|
|
deploy:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Copy repo to racknerd1
|
|
uses: appleboy/scp-action@v0.1.7
|
|
with:
|
|
host: ${{ secrets.RACKNERD_HOST }}
|
|
username: ${{ secrets.RACKNERD_USER }}
|
|
key: ${{ secrets.RACKNERD_SSH_KEY }}
|
|
port: ${{ secrets.RACKNERD_PORT || 22 }}
|
|
source: "."
|
|
target: ${{ env.DEPLOY_PATH }}
|
|
rm: false
|
|
|
|
- name: Build and restart container
|
|
uses: appleboy/ssh-action@v1.2.0
|
|
with:
|
|
host: ${{ secrets.RACKNERD_HOST }}
|
|
username: ${{ secrets.RACKNERD_USER }}
|
|
key: ${{ secrets.RACKNERD_SSH_KEY }}
|
|
port: ${{ secrets.RACKNERD_PORT || 22 }}
|
|
script: |
|
|
cd ${{ env.DEPLOY_PATH }}
|
|
docker compose up -d --build
|
|
docker image prune -f
|