wangdong 8f5dad5360
Some checks are pending
Pre-build Binary / build (push) Waiting to run
Add build script, Makefile, simplified Dockerfile, update README
2026-07-28 02:33:55 +08:00

48 lines
1.2 KiB
YAML

name: Pre-build Binary
on:
push:
branches: [ master, main ]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: '1.21'
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '16'
- name: Build Frontend
run: |
cd web/default
npm install --legacy-peer-deps
DISABLE_ESLINT_PLUGIN='true' REACT_APP_VERSION="$(cat ../../VERSION)" npm run build
cd ../..
mkdir -p web/build
cp -r web/default/build/* web/build/
- name: Build Backend
run: |
go mod download
go build -trimpath -ldflags "-s -w -X 'github.com/songquanpeng/one-api/common.Version=$(cat VERSION)'" -o one-api
- name: Upload Binary Artifact
uses: actions/upload-artifact@v3
with:
name: one-api-linux-amd64
path: one-api
- name: Upload Frontend Artifact
uses: actions/upload-artifact@v3
with:
name: frontend-build
path: web/build/