ci: add Windows build workflow and update Go version to 1.24.1

This commit is contained in:
Laisky.Cai
2025-02-28 03:49:27 +00:00
parent e755876aa0
commit e2a6c1f37a
2 changed files with 34 additions and 1 deletions

View File

@@ -144,3 +144,36 @@ jobs:
TARGETARCH=arm64
cache-from: type=gha
# cache-to: type=gha,mode=max
build_windows:
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.24.1"
- name: Add SHORT_SHA env property with commit short sha
run: echo "SHORT_SHA=`echo ${GITHUB_SHA} | cut -c1-7`" >> $GITHUB_ENV
shell: bash
- name: Build Windows executables
run: |
# Build the standard executable
go build -trimpath -ldflags "-s -w -X github.com/songquanpeng/one-api/common.Version=$(cat VERSION)" -o one-api.exe
# Make a copy with the short SHA in the name
cp one-api.exe "one-api-${{ env.SHORT_SHA }}.exe"
shell: bash
- name: Upload Windows executables
uses: actions/upload-artifact@v4
with:
name: one-api-windows
path: |
one-api.exe
one-api-${{ env.SHORT_SHA }}.exe
retention-days: 90

View File

@@ -19,7 +19,7 @@ RUN DISABLE_ESLINT_PLUGIN='true' REACT_APP_VERSION=$(cat ./VERSION) npm run buil
DISABLE_ESLINT_PLUGIN='true' REACT_APP_VERSION=$(cat ./VERSION) npm run build --prefix /web/air & \
wait
FROM golang:1.24.0-bullseye AS builder2
FROM golang:1.24.1-bullseye AS builder2
# Make sure to use ARG with a default value
ARG TARGETARCH=amd64