🎨 cicd
Some checks failed
CI / Frontend Build (push) Has been cancelled
CI / Publish Docker Image (push) Has been cancelled
CI / Backend Check (push) Has been cancelled

This commit is contained in:
comma
2026-04-02 18:54:03 +08:00
parent b3dd1549db
commit 8d391d202f
2 changed files with 88 additions and 1 deletions

87
.gitea/workflows/ci.yml Normal file
View File

@@ -0,0 +1,87 @@
name: CI
on:
push:
tags:
- "v*"
pull_request:
env:
GO_VERSION: "1.23.0"
NODE_VERSION: "18"
PNPM_VERSION: "8.6.10"
REGISTRY: code.mrx.ltd
IMAGE_NAME: code.mrx.ltd/pkg/wireguard-srv
jobs:
backend-check:
name: Backend Check
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache: true
- name: Download Go modules
run: go mod download
- name: Run Go test
run: go test ./...
- name: Verify backend build
run: go build -o /tmp/wgui .
frontend-build:
name: Frontend Build
runs-on: ubuntu-latest
defaults:
run:
working-directory: web
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: ${{ env.PNPM_VERSION }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: pnpm
cache-dependency-path: web/pnpm-lock.yaml
- name: Install frontend dependencies
run: pnpm install --frozen-lockfile
- name: Build frontend
run: pnpm build
docker-publish:
name: Publish Docker Image
if: startsWith(github.ref, 'refs/tags/v')
needs:
- backend-check
- frontend-build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Login registry
run: echo "${{ secrets.DOCKER_PWD }}" | docker login "${{ env.REGISTRY }}" -u "${{ secrets.DOCKER_USER }}" --password-stdin
- name: Build image
run: docker build -t "${{ env.IMAGE_NAME }}:${GITHUB_REF_NAME}" -t "${{ env.IMAGE_NAME }}:latest" .
- name: Push image
run: |
docker push "${{ env.IMAGE_NAME }}:${GITHUB_REF_NAME}"
docker push "${{ env.IMAGE_NAME }}:latest"

File diff suppressed because one or more lines are too long