Repository navigation
Webseite veröffentlichen #90
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |