ente_nazionale_frontend/.gitea/workflows/buildAndDeploy.yaml
Linas a61a580302
Some checks failed
Build and deploy action / deploy (push) Failing after 16s
Add Docker build and Gitea Actions CI/CD pipeline
Standalone Next.js output, production Dockerfile, and a workflow
that builds+deploys to garage on push.
2026-08-24 19:47:22 +03:00

38 lines
1.3 KiB
YAML

name: Build and deploy action
run-name: build and deploy
on: [push]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Check out
uses: actions/checkout@v4
- name: Package source
run: tar czf frontend.tar.gz --exclude=.git --exclude=node_modules --exclude=.next .
- name: Upload source to garage
uses: appleboy/scp-action@v1
with:
host: ${{ secrets.DEPLOY_HOST }}
username: ${{ secrets.DEPLOY_USER }}
key: ${{ secrets.DEPLOY_SSH_KEY }}
port: 22
source: "frontend.tar.gz"
target: "/tmp/"
- name: Build image and restart
uses: appleboy/ssh-action@v1
with:
host: ${{ secrets.DEPLOY_HOST }}
username: ${{ secrets.DEPLOY_USER }}
key: ${{ secrets.DEPLOY_SSH_KEY }}
port: 22
script: |
rm -rf /opt/docker/ente_nazionale_frontend/*
tar xzf /tmp/frontend.tar.gz -C /opt/docker/ente_nazionale_frontend
rm /tmp/frontend.tar.gz
docker build --build-arg NEXT_PUBLIC_API_URL=https://encap-be.kkava.lt/api -t ente-nazionale-frontend:1 /opt/docker/ente_nazionale_frontend
cd /opt/docker && docker compose up -d --force-recreate ente-nazionale-frontend