Files
wedding-website/.github/workflows/deployment.yaml
T
Raul Lugo e99fc2e388
Build & Deployment / Build & Deploy (push) Failing after 30s
fix: initialization retry to avoid DB startup race condition
2026-08-10 18:08:32 +02:00

72 lines
2.0 KiB
YAML

name: Build & Deployment
on:
push:
branches:
- "main"
env:
REMOTE_WORKING_DIRECTORY: compose/wedding-website
jobs:
build:
name: Build & Deploy
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
path: repository
- name: Copy Repository over SSH
uses: appleboy/scp-action@v0.1.7
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USERNAME }}
key: ${{ secrets.SSH_KEY }}
source: "repository"
target: ${{ env.REMOTE_WORKING_DIRECTORY }}
strip_components: 1
rm: true
- name: Build ENV
run: |
echo "${{ secrets.WEDDING_WEBSITE_ENV }}" | base64 -d > .env
- name: Copy ENV over SSH
uses: appleboy/scp-action@v0.1.7
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USERNAME }}
key: ${{ secrets.SSH_KEY }}
source: ".env"
target: ${{ env.REMOTE_WORKING_DIRECTORY }}
overwrite: true
- name: Docker Compose Commands
uses: appleboy/ssh-action@v1.0.3
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USERNAME }}
key: ${{ secrets.SSH_KEY }}
script_stop: true
script: |
cd ${{ env.REMOTE_WORKING_DIRECTORY }}
docker compose build
docker compose up -d wedding-db wedding-minio wedding-minio-init
docker compose up --force-recreate --abort-on-container-exit --exit-code-from wedding-migrate wedding-migrate
docker compose up -d wedding-app
docker compose images
docker image prune --all --force
- name: Clean .env
if: always()
uses: appleboy/ssh-action@v1.0.3
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USERNAME }}
key: ${{ secrets.SSH_KEY }}
script: |
cd ${{ env.REMOTE_WORKING_DIRECTORY }}
rm -f .env