Files
AntiCaptcha/.gitea/workflows/build.yml
T
admin 4376cf936a
Build and Deploy / deploy (push) Has been cancelled
Build and Deploy / build (push) Has been cancelled
ci: auto-create docker-compose.yml if not exists on deploy
2026-07-17 00:10:11 +00:00

75 lines
1.8 KiB
YAML

name: Build and Deploy
on:
push:
branches:
- main
tags:
- 'v*'
jobs:
build:
runs-on: ubuntu-latest
container:
image: catthehacker/ubuntu:act-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Build frontend
working-directory: ./web
run: |
npm install
npm run build
- name: Setup Docker
uses: docker/setup-buildx-action@v3
- name: Login to Registry
uses: docker/login-action@v3
with:
registry: git.viaeon.com
username: ${{ github.actor }}
password: ${{ secrets.TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: git.viaeon.com/admin/anticaptcha:latest
deploy:
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to server
uses: appleboy/ssh-action@v1.0.3
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USER }}
password: ${{ secrets.SSH_PASSWORD }}
port: ${{ secrets.SSH_PORT || 22 }}
script: |
mkdir -p /opt/anticaptcha
cd /opt/anticaptcha
if [ ! -f docker-compose.yml ]; then
cat > docker-compose.yml << 'EOF'
services:
anticaptcha:
image: git.viaeon.com/admin/anticaptcha:latest
ports:
- "6688:6688"
volumes:
- ./data:/app/data
- ./models:/app/models
restart: unless-stopped
EOF
fi
docker compose pull
docker compose up -d