add
Deploy Static Site / deploy (push) Successful in 10m9s

This commit is contained in:
Lars Nolden
2026-08-13 23:31:03 +02:00
parent 9582ea0198
commit 1eb73a957b
29 changed files with 77 additions and 39 deletions
+55
View File
@@ -0,0 +1,55 @@
name: Deploy Static Site
on:
push:
branches:
- master
paths:
- "component-library/**"
- ".gitea/workflows/deploy.yml"
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
cache-dependency-path: component-library/package-lock.json
- name: Install dependencies
working-directory: component-library
run: npm ci
- name: Build static site
working-directory: component-library
run: npm run build
- name: Setup SSH key
run: |
mkdir -p ~/.ssh
chmod 700 ~/.ssh
echo "${{ secrets.DEPLOY_SSH_KEY }}" > ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519
- name: Deploy static files to server
env:
DEPLOY_HOST: ${{ secrets.DEPLOY_HOST }}
REMOTE_DIR: /home/deploy/projects/ge-bos/static
run: |
SSH="ssh -i ~/.ssh/id_ed25519 -o StrictHostKeyChecking=accept-new"
# Recreate the target dir so removed files don't linger (rsync --delete equivalent)
$SSH deploy@"$DEPLOY_HOST" "rm -rf '$REMOTE_DIR' && mkdir -p '$REMOTE_DIR'"
# Stream the build output over ssh and extract it on the server
tar -czf - -C component-library/dist . | $SSH deploy@"$DEPLOY_HOST" "tar -xzf - -C '$REMOTE_DIR'"
- name: Run deployment script
run: |
ssh -i ~/.ssh/id_ed25519 -o StrictHostKeyChecking=accept-new \
deploy@${{ secrets.DEPLOY_HOST }} \
"cd /home/deploy/projects/ge-bos && ./deploy.sh"