8258160f95
- Use github.actor instead of gitea.actor - Add act-latest container for Gitea Actions - Simplify Dockerfile to use alpine - Remove CGO dependencies - Fix frontend build path
61 lines
1.4 KiB
YAML
61 lines
1.4 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
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
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 }}
|
|
script: |
|
|
cd /opt/anticaptcha
|
|
docker-compose pull
|
|
docker-compose up -d |