elmeg-demo/.forgejo/workflows/deploy.yml
fullsizemalt 29c2033bca
Some checks are pending
Deploy Elmeg / deploy (push) Waiting to run
feat: Add CI/CD workflow for testing/production branch deployments
2025-12-20 23:49:36 -08:00

41 lines
1.4 KiB
YAML

name: Deploy Elmeg
on:
push:
branches:
- testing
- production
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set deployment target
id: target
run: |
if [ "${{ github.ref_name }}" = "testing" ]; then
echo "server=nexus-vector" >> $GITHUB_OUTPUT
echo "domain=elmeg.runfoo.run" >> $GITHUB_OUTPUT
elif [ "${{ github.ref_name }}" = "production" ]; then
echo "server=tangible-aacorn" >> $GITHUB_OUTPUT
echo "domain=elmeg.xyz" >> $GITHUB_OUTPUT
fi
- name: Deploy to ${{ steps.target.outputs.server }}
uses: appleboy/ssh-action@v1.0.3
with:
host: ${{ steps.target.outputs.server == 'nexus-vector' && '216.158.230.94' || '159.69.219.254' }}
username: root
key: ${{ secrets.DEPLOY_SSH_KEY }}
script: |
cd /srv/containers/elmeg-demo
git fetch origin ${{ github.ref_name }}
git checkout ${{ github.ref_name }}
git reset --hard origin/${{ github.ref_name }}
docker compose build --no-cache
docker compose up -d
docker compose exec -T backend alembic upgrade head
echo "Deployed ${{ github.ref_name }} to ${{ steps.target.outputs.domain }}"