add deploy workflow
Some checks failed
Build and Deploy / deploy (push) Failing after 9s

This commit is contained in:
andy-sg
2026-03-05 19:10:53 +09:00
parent f1a98ddce3
commit c96613fd32

View File

@@ -1,4 +1,5 @@
name: Build and Deploy name: Build and Deploy
on: on:
push: push:
branches: [main] branches: [main]
@@ -7,18 +8,31 @@ jobs:
deploy: deploy:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - name: Checkout
- uses: actions/setup-node@v4 uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with: with:
node-version: 20 node-version: '20'
- run: npm ci
- run: npm run build - name: Install dependencies
run: npm ci
- name: Build
run: npm run build
- name: Deploy to Synology - name: Deploy to Synology
env:
DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }}
DEPLOY_HOST: ${{ secrets.DEPLOY_HOST }}
DEPLOY_USER: ${{ secrets.DEPLOY_USER }}
run: | run: |
apt-get update && apt-get install -y rsync openssh-client
mkdir -p ~/.ssh mkdir -p ~/.ssh
echo "${{ secrets.DEPLOY_KEY }}" > ~/.ssh/id_ed25519 echo "$DEPLOY_KEY" > ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519 chmod 600 ~/.ssh/id_ed25519
ssh-keyscan -p 22 10.0.0.19 >> ~/.ssh/known_hosts ssh-keyscan -H $DEPLOY_HOST >> ~/.ssh/known_hosts 2>/dev/null
ssh wapj2000@10.0.0.19 "mkdir -p /volume1/web/one-verse-a-day"
rsync -avz --delete -e "ssh" dist/ wapj2000@10.0.0.19:/volume1/web/one-verse-a-day/0 rsync -avz --delete \
dist/ \
${DEPLOY_USER}@${DEPLOY_HOST}:/volume1/web/app/