Files
fewo-stommer/.gitea/workflows/deploy.yml
T
Lars Stommer abf0e9004b
Deploy / test (push) Failing after 2m47s
Deploy / deploy (push) Skipped
Wohnung je Baustein wählen und Gitea-Runner-Kompatibilität herstellen
2026-10-26 08:23:14 +01:00

108 lines
3.5 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Tests on every push; deployment to Strato for tags "v*" or by hand (Gitea › Actions › Deploy › Run workflow).
# Needs a Gitea act_runner (e.g. on the private server) and these repository secrets:
# DEPLOY_SSH_KEY private key whose public key is stored at Strato (SFTP & SSH)
# DEPLOY_HOST package-specific SSH server, e.g. 51539426.ssh.w1.strato.hosting (not ssh.strato.de)
# DEPLOY_USER SSH user from the Strato customer login
# DEPLOY_PATH e.g. fewo-production
# DEPLOY_PHP e.g. /opt/RZphp84/bin/php-cli
# DEPLOY_URL e.g. https://www.fewo-stommer.de
name: Deploy
on:
push:
branches: [main]
tags: ['v*']
workflow_dispatch:
inputs:
environment:
description: Ziel
type: choice
options: [production, staging]
default: production
jobs:
test:
runs-on: ubuntu-latest
services:
mariadb:
image: mariadb:11.8
env:
MARIADB_DATABASE: fewo_test
MARIADB_ROOT_PASSWORD: test
ports: ['3306:3306']
options: >-
--health-cmd="healthcheck.sh --connect --innodb_initialized"
--health-interval=5s --health-timeout=5s --health-retries=20
steps:
- uses: actions/checkout@v4
# act_runner v0.2.11 supports Node 20; newer setup-php releases require Node 24.
- uses: shivammathur/setup-php@2.36.0
with:
php-version: '8.4'
extensions: mbstring, intl, gd, exif, zip, pdo_sqlite, sqlite3, pdo_mysql, fileinfo, openssl
tools: composer:v2
- uses: actions/setup-node@v4
with:
node-version: '22'
cache: npm
- name: Install
run: |
composer install --no-interaction --no-progress --prefer-dist
npm ci --no-audit --no-fund
npm run build
cp .env.example .env
php artisan key:generate
- name: Tests (SQLite)
run: php artisan test --compact --testsuite=Feature
- name: Tests (MariaDB 11.8, wie auf Strato)
env:
DB_CONNECTION: mariadb
DB_HOST: 127.0.0.1
DB_PORT: '3306'
DB_DATABASE: fewo_test
DB_USERNAME: root
DB_PASSWORD: test
run: php artisan test --compact --testsuite=Feature
deploy:
needs: test
if: startsWith(github.ref, 'refs/tags/v') || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Keep the runtime compatible with the test job and the installed act_runner.
- uses: shivammathur/setup-php@2.36.0
with:
php-version: '8.4'
extensions: mbstring, intl, gd, exif, zip, fileinfo, openssl
tools: composer:v2
- uses: actions/setup-node@v4
with:
node-version: '22'
cache: npm
- name: SSH key
run: |
mkdir -p ~/.ssh
printf '%s\n' "${{ secrets.DEPLOY_SSH_KEY }}" > ~/.ssh/deploy_key
chmod 600 ~/.ssh/deploy_key
ssh-keyscan -H "${{ secrets.DEPLOY_HOST }}" >> ~/.ssh/known_hosts
- name: Deploy
env:
DEPLOY_HOST: ${{ secrets.DEPLOY_HOST }}
DEPLOY_USER: ${{ secrets.DEPLOY_USER }}
DEPLOY_PATH: ${{ secrets.DEPLOY_PATH }}
DEPLOY_PHP: ${{ secrets.DEPLOY_PHP }}
DEPLOY_URL: ${{ secrets.DEPLOY_URL }}
run: |
export DEPLOY_SSH_KEY="$HOME/.ssh/deploy_key"
bash scripts/deploy.sh "${{ inputs.environment || 'production' }}" deploy