ci: migrate GitHub actions to Gitea actions
Deploy CV Site (andreknie.de) / deploy (push) Canceled after 0s

This commit is contained in:
2026-07-22 15:42:06 +02:00
parent e1cf49b0a2
commit b46de6dc7d
649 changed files with 127224 additions and 2786 deletions
+111
View File
@@ -0,0 +1,111 @@
name: Deploy Jury Voting
on:
push:
branches:
paths:
- 'dhive/Jury-Voting/**'
- main
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v5
- name: Set up Node.js
uses: actions/setup-node@v5
with:
node-version: 20
cache: npm
- name: Install dependencies
run: npm ci
- name: Build frontend
env:
NODE_ENV: production
run: npm run build
- name: Create deployment archive
run: |
tar czf deploy.tar.gz \
--exclude='*.pdf' \
--exclude='*.doc' \
--exclude='*.xlsx' \
--exclude='Teams' \
--exclude='node_modules' \
--exclude='.git' \
dist/ \
server/ \
shared/ \
package.json \
package-lock.json \
jury-voting.service \
tsconfig.json \
tsconfig.node.json
- name: Deploy to VPS
uses: appleboy/ssh-action@v1
with:
host: 217.160.174.2
username: root
key: ${{ secrets.DEPLOY_SSH_KEY }}
script: |
mkdir -p /opt/jury-voting/server/data
- name: Upload archive
uses: appleboy/scp-action@v0.1.7
with:
host: 217.160.174.2
username: root
key: ${{ secrets.DEPLOY_SSH_KEY }}
source: deploy.tar.gz
target: /tmp/
- name: Extract and start service
uses: appleboy/ssh-action@v1
with:
host: 217.160.174.2
username: root
key: ${{ secrets.DEPLOY_SSH_KEY }}
script: |
set -e
# Install Node.js if not present
if ! command -v node &> /dev/null; then
curl -fsSL https://deb.nodesource.com/setup_20.x | bash -
apt-get install -y nodejs
fi
# Extract archive (preserve session.json)
cd /opt/jury-voting
tar xzf /tmp/deploy.tar.gz --overwrite
rm -f /tmp/deploy.tar.gz
# Install production dependencies
npm ci --omit=dev
# Seed data if first run
if [ ! -f server/data/session.json ]; then
cp server/data/seed.json server/data/session.json
fi
# Install and restart systemd service
cp jury-voting.service /etc/systemd/system/jury-voting.service
systemctl daemon-reload
systemctl enable jury-voting
systemctl restart jury-voting
# Verify
sleep 2
curl -sf http://localhost:3002/api/health && echo "Deploy successful!" || (journalctl -u jury-voting -n 20 --no-pager && exit 1)