mirror of
https://github.com/songquanpeng/one-api.git
synced 2025-09-17 09:16:36 +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:
|
jobs:
|
||||||
build_tests:
|
build_tests:
|
||||||
name: "build tests"
|
name: "Build & Test PR"
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Check repository URL
|
- name: Check repository URL
|
||||||
run: |
|
run: |
|
||||||
REPO_URL=$(git config --get remote.origin.url)
|
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
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- uses: actions/setup-node@v3
|
- uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: 16
|
node-version: 16
|
||||||
|
|
||||||
- name: Build Frontend
|
- name: Build Frontend
|
||||||
env:
|
env:
|
||||||
CI: ""
|
CI: ""
|
||||||
run: |
|
run: |
|
||||||
cd web
|
cd web
|
||||||
git describe --tags > VERSION
|
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 ..
|
cd ..
|
||||||
|
|
||||||
- name: Set up Go
|
- name: Set up Go
|
||||||
uses: actions/setup-go@v3
|
uses: actions/setup-go@v3
|
||||||
with:
|
with:
|
||||||
go-version: '>=1.18.0'
|
go-version: '1.18' # 使用稳定版本
|
||||||
|
|
||||||
- name: Build Backend (amd64)
|
- name: Build Backend (amd64)
|
||||||
run: |
|
run: |
|
||||||
|
VERSION=$(git describe --tags)
|
||||||
|
LDFLAGS="-s -w -X 'github.com/songquanpeng/one-api/common.Version=$VERSION' -extldflags '-static'"
|
||||||
|
|
||||||
go mod download
|
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)
|
- name: Build Backend (arm64)
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get install gcc-aarch64-linux-gnu
|
sudo apt-get install -y 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
|
|
||||||
|
|
||||||
|
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:
|
commit_lint:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
Loading…
Reference in New Issue
Block a user