Files
molenda.net/.gitea/workflows/deploy.yml
T
2026-05-13 22:43:29 +02:00

75 lines
2.8 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.
name: Deploy on merge to main
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
# ── 1. Checkout ──────────────────────────────────────────────────────────
- name: Checkout repository
uses: actions/checkout@v4
# ── 2. PHP + Composer ────────────────────────────────────────────────────
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
extensions: pdo, pdo_sqlite, sqlite3
- name: Install Composer dependencies (production only)
run: composer install --no-dev --optimize-autoloader
# ── 3. Pobierz aktualną bazę SQLite z serwera ────────────────────────────
# data.sqlite3 z repo NIE trafia na serwer ściągamy produkcyjną wersję,
# uruchamiamy na niej migracje i wgrywamy z powrotem.
- name: Install lftp
run: sudo apt-get install -y lftp
- name: Download production data.sqlite3 via FTP
run: |
lftp -u "${{ secrets.FTP_USER }}","${{ secrets.FTP_PASS }}" \
-e "set ftp:ssl-allow no; \
set ssl:verify-certificate no; \
get ${{ secrets.FTP_REMOTE_DIR }}/data.sqlite3 -o ./data.sqlite3; \
quit" \
${{ secrets.FTP_HOST }}
# ── 4. Uruchom migracje Phinx na pobranej bazie ──────────────────────────
# phinx.php: 'name' => __DIR__ . '/data' → plik data.sqlite3
- name: Run Phinx migrations
run: ./vendor/bin/phinx migrate -e main
# ── 5. Wgraj pliki na serwer (z zaktualizowaną bazą) ────────────────────
- name: Deploy files to server via FTP
uses: SamKirkland/FTP-Deploy-Action@v4.3.5
with:
server: ${{ secrets.FTP_HOST }}
username: ${{ secrets.FTP_USER }}
password: ${{ secrets.FTP_PASS }}
local-dir: ./
server-dir: ${{ secrets.FTP_REMOTE_DIR }}/
exclude: |
**/.git/**
**/.gitea/**
**/tests/**
**/docker/**
**/html_template/**
**/lib/**
**/var/cache/**
**/logs/**
docker-compose*.yml
Dockerfile
phpunit.xml
phpcs.xml
phpstan.neon.dist
README.md
CONTRIBUTING.md
.env*
local.data.sqlite3
server.data.sqlite3