Files
mathew/.gitea/workflows/deploy.yml
Aran Roig e2c2c66d7f
Some checks failed
Build and Deploy Lean / build (push) Failing after 16m44s
Build and Deploy Nuxt / build (push) Failing after 48s
Vibecoded CI/CD
2026-10-06 00:23:17 +02:00

61 lines
2.1 KiB
YAML

name: Build and Deploy Nuxt
on:
push:
branches: [master]
# The Lean editor carries Mathlib and moves on its own schedule — its
# image is built and pushed by deploy-lean.yml, only when lean/** changes
paths-ignore:
- "lean/**"
jobs:
build:
runs-on: docker
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install SSH client
run: |
apt-get update -y && apt-get install -y openssh-client
- name: Setup SSH inside container
run: |
mkdir -p ~/.ssh
echo "${{ secrets.DEPLOY_KEY }}" > ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519
# Add the container host to known_hosts
ssh-keyscan -H ${{ secrets.DEPLOY_HOST }} >> ~/.ssh/known_hosts
- name: Log in to registry
run: |
echo "${{ secrets.REGISTRY_PASSWORD }}" | docker login git.aranroig.com -u "${{ secrets.REGISTRY_USER }}" --password-stdin
- name: Build frontend
run: |
docker build -t git.aranroig.com/${{ secrets.REGISTRY_USER }}/mathew-frontend:latest ./frontend
docker push git.aranroig.com/${{ secrets.REGISTRY_USER }}/mathew-frontend:latest
- name: Build backend
run: |
docker build -t git.aranroig.com/${{ secrets.REGISTRY_USER }}/mathew-backend:latest ./backend
docker push git.aranroig.com/${{ secrets.REGISTRY_USER }}/mathew-backend:latest
- name: Copy files
run: |
scp docker-compose.yml deploy@${{ secrets.DEPLOY_HOST }}:/var/www/app/
scp nginx.conf deploy@${{ secrets.DEPLOY_HOST }}:/var/www/app/nginx.conf
# `compose pull` also pulls the lean image from the registry —
# deploy-lean.yml is what keeps that tag current
- name: Deploy
run: |
ssh deploy@${{ secrets.DEPLOY_HOST }} << 'EOF'
echo "${{ secrets.REGISTRY_PASSWORD }}" | docker login git.aranroig.com -u "${{ secrets.REGISTRY_USER }}" --password-stdin
cd /var/www/app/
docker compose pull
docker compose up -d --remove-orphans
EOF