mirror of
https://github.com/songquanpeng/one-api.git
synced 2025-09-17 01:06:37 +08:00
fix: fix some build action bug
This commit is contained in:
parent
859dad5dc2
commit
eeb93666b2
28
.github/workflows/ci.yml
vendored
28
.github/workflows/ci.yml
vendored
@ -23,45 +23,59 @@ on:
|
||||
|
||||
jobs:
|
||||
build_tests:
|
||||
name: "build tests"
|
||||
name: "Build & Test PR"
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Check repository URL
|
||||
run: |
|
||||
REPO_URL=$(git config --get remote.origin.url)
|
||||
if [[ $REPO_URL == *"pro" ]]; then
|
||||
if [[ "$REPO_URL" == *"pro.git" ]]; then
|
||||
echo "This repository is not allowed to build."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 16
|
||||
|
||||
- name: Build Frontend
|
||||
env:
|
||||
CI: ""
|
||||
run: |
|
||||
cd web
|
||||
git describe --tags > VERSION
|
||||
REACT_APP_VERSION=$(git describe --tags) chmod u+x ./build.sh && ./build.sh
|
||||
export REACT_APP_VERSION=$(git describe --tags)
|
||||
chmod u+x ./build.sh
|
||||
./build.sh
|
||||
cd ..
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: '>=1.18.0'
|
||||
go-version: '1.18' # 使用稳定版本
|
||||
|
||||
- name: Build Backend (amd64)
|
||||
run: |
|
||||
VERSION=$(git describe --tags)
|
||||
LDFLAGS="-s -w -X 'github.com/songquanpeng/one-api/common.Version=$VERSION' -extldflags '-static'"
|
||||
|
||||
go mod download
|
||||
go build -ldflags "-s -w -X 'github.com/songquanpeng/one-api/common.Version=$(git describe --tags)' -extldflags '-static'" -o one-api
|
||||
go build -ldflags "$LDFLAGS" -o one-api
|
||||
|
||||
- name: Build Backend (arm64)
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install gcc-aarch64-linux-gnu
|
||||
CC=aarch64-linux-gnu-gcc CGO_ENABLED=1 GOOS=linux GOARCH=arm64 go build -ldflags "-s -w -X 'one-api/common.Version=$(git describe --tags)' -extldflags '-static'" -o one-api-arm64
|
||||
sudo apt-get install -y gcc-aarch64-linux-gnu
|
||||
|
||||
VERSION=$(git describe --tags)
|
||||
LDFLAGS="-s -w -X 'github.com/songquanpeng/one-api/common.Version=$VERSION' -extldflags '-static'"
|
||||
|
||||
CC=aarch64-linux-gnu-gcc CGO_ENABLED=1 GOOS=linux GOARCH=arm64 go build -ldflags "$LDFLAGS" -o one-api-arm64
|
||||
|
||||
commit_lint:
|
||||
runs-on: ubuntu-latest
|
||||
|
Loading…
Reference in New Issue
Block a user