fix: CI/CD build errors
Build and Deploy / build (push) Failing after 3s
Build and Deploy / deploy (push) Has been skipped

- Simplified go.mod with all dependencies
- Fixed generateRandomSecret function
- Updated Dockerfile to use debian bookworm
- Simplified CI workflow to single job
- Fixed Gitea Actions syntax (github.ref)
This commit is contained in:
2026-07-16 09:23:24 +00:00
parent 029e5ac0d0
commit 731e00855b
4 changed files with 90 additions and 83 deletions
+7 -56
View File
@@ -12,7 +12,7 @@ env:
IMAGE_NAME: anticaptcha
jobs:
build-frontend:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
@@ -21,66 +21,20 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: web/package-lock.json
- name: Install dependencies
- name: Install frontend dependencies
working-directory: ./web
run: npm ci
run: npm install
- name: Build frontend
working-directory: ./web
run: npm run build
- name: Upload frontend artifacts
uses: actions/upload-artifact@v4
with:
name: frontend
path: web/dist
build-backend:
runs-on: ubuntu-latest
needs: build-frontend
steps:
- uses: actions/checkout@v4
- name: Download frontend artifacts
uses: actions/download-artifact@v4
with:
name: frontend
path: web/dist
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.22'
- name: Build Go binary
run: |
CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o anticaptcha ./cmd/server
- name: Upload backend artifacts
uses: actions/upload-artifact@v4
with:
name: backend
path: anticaptcha
build-docker:
runs-on: ubuntu-latest
needs: build-frontend
steps:
- uses: actions/checkout@v4
- name: Download frontend artifacts
uses: actions/download-artifact@v4
with:
name: frontend
path: web/dist
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
@@ -95,23 +49,20 @@ jobs:
tags: |
type=ref,event=branch
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=sha
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
push: true
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
deploy:
runs-on: ubuntu-latest
needs: build-docker
if: startsWith(gitea.ref, 'refs/tags/')
needs: build
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Deploy to server
uses: appleboy/ssh-action@v1.0.3