Files
AntiCaptcha/.gitea/workflows/build.yml
T
admin 16e2f649b1
Build and Deploy / build (push) Successful in 2m42s
Build and Deploy / deploy (push) Successful in 8s
fix: set fixed JWT_SECRET environment variable in docker-compose
2026-07-17 07:46:25 +00:00

77 lines
2.0 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: |
DEPLOY_PATH="${{ secrets.DEPLOY_PATH || '/opt/anticaptcha' }}"
mkdir -p $DEPLOY_PATH
cd $DEPLOY_PATH
# 始终更新 docker-compose.yml 以确保环境变量正确
cat > docker-compose.yml << 'EOF'
services:
anticaptcha:
image: git.viaeon.com/admin/anticaptcha:latest
ports:
- "6688:6688"
volumes:
- ./data:/app/data
- ./models:/app/models
environment:
- JWT_SECRET=anticaptcha-fixed-jwt-secret-2024
restart: unless-stopped
EOF
docker compose pull
docker compose up -d