ludops-skeleton/.gitea/workflows/deploy.yml

39 lines
1.3 KiB
YAML

name: Build and Deploy
on: [ push ]
jobs:
build-and-push:
runs-on: ubuntu-latest # This refers to your self-hosted runner
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Gitea Registry
uses: docker/login-action@v2
with:
registry: git.ludops.com
username: ${{ gitea.actor }}
password: ${{ secrets.CI_TOKEN }}
- name: Build and Push
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: git.ludops.com/${{ gitea.repository }}:latest
- name: Deploy to Server
run: |
# Here we tell the server to pull the new image and restart
echo "${{ secrets.CI_TOKEN }}" | docker login git.ludops.com -u ${{ gitea.actor }} --password-stdin
docker compose -f docker-compose.prod.yml pull
docker run --rm --network infrastructure_infra-network \
-e DATABASE_URL=postgres://gitea:gitea@ludops-postgres:5432/skeleton_db \
git.ludops.com/ludops/ludops-skeleton:latest \
-c "pnpm add -g drizzle-kit && drizzle-kit push"
docker compose -f docker-compose.prod.yml up -d