Repository navigation
76 lines (71 loc) · 2.58 KB
/
Copy pathdeploy-website.yml
File metadata and controls
76 lines (71 loc) · 2.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
name: Webseite veröffentlichen
# Lädt website/ nach All-Inkl (visustruct.org) hoch.
# Start: Tag web-v… anlegen (z. B. web-v1.0, auch über „Draft a new release“)
# oder von Hand unter Actions → „Webseite veröffentlichen“ → „Run workflow“.
# Ändert ein PR den Upload selbst, läuft nur ein Trockenlauf gegen den Server.
on:
pull_request:
paths:
- '.github/workflows/deploy-website.yml'
- '.github/scripts/deploy-website.sh'
push:
tags: ['web-v*']
workflow_dispatch:
inputs:
dry_run:
description: 'Trockenlauf: nur anzeigen, was hochgeladen und gelöscht würde'
type: boolean
default: false
permissions:
contents: read
concurrency:
group: deploy-website
cancel-in-progress: false
jobs:
check:
runs-on: ubuntu-latest
defaults:
run:
working-directory: web
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
cache-dependency-path: web/package-lock.json
- run: npm ci
- name: Test
run: npm test
- name: website/app ist aktuell
run: |
npm run build:site
git diff --exit-code -- ../website/app || (echo "website/app ist veraltet: in web/ 'npm run build:site' ausführen und committen." && exit 1)
test -z "$(git status --porcelain -- ../website/app)"
deploy:
needs: check
# PRs aus Forks bekommen keine Secrets
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Zugangsdaten vorhanden?
env:
SFTP_USER: ${{ secrets.SFTP_USER }}
SFTP_PASSWORD: ${{ secrets.SFTP_PASSWORD }}
run: |
if [ -z "$SFTP_USER" ] || [ -z "$SFTP_PASSWORD" ]; then
echo "::error::Die Secrets SFTP_USER und SFTP_PASSWORD fehlen (Settings → Secrets and variables → Actions)."
exit 1
fi
- name: lftp installieren
run: sudo apt-get update -q && sudo apt-get install -y -q lftp
- name: Hochladen
env:
DEPLOY_HOST: ${{ vars.DEPLOY_HOST || 'w0103087.kasserver.com' }}
DEPLOY_PROTOCOL: ${{ vars.DEPLOY_PROTOCOL || 'ftps' }}
DEPLOY_DIR: ${{ vars.DEPLOY_DIR }}
DEPLOY_USER: ${{ secrets.SFTP_USER }}
LFTP_PASSWORD: ${{ secrets.SFTP_PASSWORD }}
DRY_RUN: ${{ (inputs.dry_run || github.event_name == 'pull_request') && '1' || '0' }}
run: .github/scripts/deploy-website.sh