Files
social-media/.gitea/workflows/deploy-socialize.yml
Jonathan Bourdon c40653b2b7
All checks were successful
deploy-socialize / deploy (push) Successful in 8s
deploy-socialize / image (push) Successful in 32s
chore(ci): guards against tracked build artefacts
2026-05-05 23:41:20 -04:00

57 lines
2.1 KiB
YAML

name: deploy-socialize
on:
push:
branches:
- main
jobs:
image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check repository hygiene
run: ./scripts/check-repo-hygiene.sh
- name: Install Docker CLI
run: apt-get update && apt-get install -y docker.io
- name: Login to Gitea container registry
env:
REGISTRY_USER: ${{ secrets.REGISTRY_USER }}
REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }}
run: printf '%s' "$REGISTRY_PASSWORD" | docker login git.mapachotes.com -u "$REGISTRY_USER" --password-stdin
- name: Build images
run: |
docker build \
-t git.mapachotes.com/jbourdon/socialize-api:${{ gitea.sha }} \
-t git.mapachotes.com/jbourdon/socialize-api:latest \
-f backend/src/Socialize.Api/Dockerfile .
docker build \
--build-arg VITE_API_URL=/api \
-t git.mapachotes.com/jbourdon/socialize-web:${{ gitea.sha }} \
-t git.mapachotes.com/jbourdon/socialize-web:latest \
-f frontend/Dockerfile .
- name: Push images
run: |
docker push git.mapachotes.com/jbourdon/socialize-api:${{ gitea.sha }}
docker push git.mapachotes.com/jbourdon/socialize-api:latest
docker push git.mapachotes.com/jbourdon/socialize-web:${{ gitea.sha }}
docker push git.mapachotes.com/jbourdon/socialize-web:latest
deploy:
needs: image
runs-on: bookworm
steps:
- name: Install SSH client
run: apt-get update && apt-get install -y openssh-client
- name: Deploy on sobina
env:
DEPLOY_HOST: ${{ secrets.DEPLOY_HOST }}
DEPLOY_USER: ${{ secrets.DEPLOY_USER }}
DEPLOY_SSH_PRIVATE_KEY_B64: ${{ secrets.DEPLOY_SSH_PRIVATE_KEY_B64 }}
run: |
mkdir -p ~/.ssh
printf '%s' "$DEPLOY_SSH_PRIVATE_KEY_B64" | base64 -d > ~/.ssh/deploy_key
chmod 600 ~/.ssh/deploy_key
ssh -i ~/.ssh/deploy_key -o StrictHostKeyChecking=accept-new "$DEPLOY_USER@$DEPLOY_HOST" \
'cd /srv/prod/socialize && ./deploy.sh'