Files
ARTEX-chixuweihu/.github/workflows/release.yml
T
Autumn-27andClaude Opus 4.8 0ef8561411 chore: ARTEX 初始化
ARTEX — AI 自主渗透测试系统(Go 后端 + Next.js 前端,单二进制内嵌)。

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
2026-07-26 04:27:45 -04:00

133 lines
4.0 KiB
YAML

name: release
on:
push:
tags: ["v*"]
permissions:
contents: write # 创建 Release 需要
jobs:
# ① 前端静态导出(一次),产物给交叉编译各平台复用
frontend:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "22"
cache: npm
cache-dependency-path: web/package-lock.json
- run: npm ci
working-directory: web
- run: npm run build:static
working-directory: web
- uses: actions/upload-artifact@v4
with:
name: web-dist
path: web/out
# ② 五平台交叉编译(内嵌前端)+ 打 zip
binaries:
needs: frontend
runs-on: ubuntu-latest
strategy:
matrix:
include:
- { goos: linux, goarch: amd64 }
- { goos: linux, goarch: arm64 }
- { goos: darwin, goarch: amd64 }
- { goos: darwin, goarch: arm64 }
- { goos: windows, goarch: amd64 }
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.26"
cache: true
- uses: actions/download-artifact@v4
with:
name: web-dist
path: server/webui/dist
- name: Build
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
CGO_ENABLED: "0"
run: |
BIN=artex
[ "$GOOS" = "windows" ] && BIN=artex.exe
go build -tags embedui -trimpath \
-ldflags "-s -w -X main.version=${GITHUB_REF_NAME}" \
-o "$BIN" ./cmd/artex
- name: Package
run: |
NAME="artex-${GITHUB_REF_NAME}-${{ matrix.goos }}-${{ matrix.goarch }}"
mkdir -p "$NAME"
cp -r skills "$NAME"/
cp config.example.json "$NAME"/
if [ "${{ matrix.goos }}" = "windows" ]; then cp artex.exe "$NAME"/; else cp artex "$NAME"/; fi
zip -r "$NAME.zip" "$NAME"
- uses: actions/upload-artifact@v4
with:
name: pkg-${{ matrix.goos }}-${{ matrix.goarch }}
path: "*.zip"
# Linux 生二进制单独上传,供 docker job 复用(免在镜像里重编前端+Go)
- if: matrix.goos == 'linux'
uses: actions/upload-artifact@v4
with:
name: bin-linux-${{ matrix.goarch }}
path: artex
# ③ 汇总所有 zip → 创建 GitHub Release
release:
needs: binaries
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
pattern: pkg-*
merge-multiple: true
path: dist
- uses: softprops/action-gh-release@v2
with:
files: dist/*.zip
generate_release_notes: true
# ④ 多架构镜像 → 推 Docker Hub(复用 binaries 编好的 Linux 二进制,
# 镜像里只装工具 + 放二进制;arm64 仅需模拟 apt 层,构建快很多)
docker:
needs: binaries
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4 # 取 Dockerfile 与 skills/
- uses: actions/download-artifact@v4
with:
name: bin-linux-amd64
path: dist/amd64
- uses: actions/download-artifact@v4
with:
name: bin-linux-arm64
path: dist/arm64
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: docker/metadata-action@v5
id: meta
with:
images: autumn27/artex
tags: |
type=ref,event=tag
type=raw,value=latest
- uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max