chore: update build workflows for Electron and Go, including version tagging and dependency management
This commit is contained in:
parent
02c0cbcc6a
commit
32f806d562
79
.github/workflows/electron-build.yml
vendored
79
.github/workflows/electron-build.yml
vendored
@ -3,20 +3,31 @@ name: Build Electron App
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
tags:
|
tags:
|
||||||
- 'v*.*.*' # Triggers on version tags like v1.0.0
|
- '*' # Triggers on version tags like v1.0.0
|
||||||
workflow_dispatch: # Allows manual triggering
|
workflow_dispatch: # Allows manual triggering
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os: [macos-latest, windows-latest]
|
# os: [macos-latest, windows-latest]
|
||||||
|
os: [windows-latest]
|
||||||
|
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
shell: bash
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Setup Bun
|
||||||
|
uses: oven-sh/setup-bun@v2
|
||||||
|
with:
|
||||||
|
bun-version: latest
|
||||||
|
|
||||||
- name: Setup Node.js
|
- name: Setup Node.js
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v4
|
||||||
@ -26,39 +37,49 @@ jobs:
|
|||||||
- name: Setup Go
|
- name: Setup Go
|
||||||
uses: actions/setup-go@v5
|
uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version: '1.21'
|
go-version: '>=1.18.0'
|
||||||
|
|
||||||
- name: Build frontend
|
- name: Build frontend
|
||||||
|
env:
|
||||||
|
CI: ""
|
||||||
|
NODE_OPTIONS: "--max-old-space-size=4096"
|
||||||
run: |
|
run: |
|
||||||
cd web
|
cd web
|
||||||
npm install --legacy-peer-deps
|
bun install
|
||||||
npm run build
|
DISABLE_ESLINT_PLUGIN='true' VITE_REACT_APP_VERSION=$(git describe --tags) bun run build
|
||||||
env:
|
cd ..
|
||||||
DISABLE_ESLINT_PLUGIN: 'true'
|
|
||||||
NODE_OPTIONS: '--max_old_space_size=4096'
|
|
||||||
|
|
||||||
- name: Build Go binary (macos/Linux)
|
# - name: Build Go binary (macos/Linux)
|
||||||
if: runner.os != 'Windows'
|
# if: runner.os != 'Windows'
|
||||||
run: |
|
# run: |
|
||||||
go build -ldflags="-s -w" -o new-api
|
# go mod download
|
||||||
|
# go build -ldflags "-s -w -X 'one-api/common.Version=$(git describe --tags)' -extldflags '-static'" -o new-api
|
||||||
|
|
||||||
- name: Build Go binary (Windows)
|
- name: Build Go binary (Windows)
|
||||||
if: runner.os == 'Windows'
|
if: runner.os == 'Windows'
|
||||||
run: |
|
run: |
|
||||||
go build -ldflags="-s -w" -o new-api.exe
|
go mod download
|
||||||
|
go build -ldflags "-s -w -X 'one-api/common.Version=$(git describe --tags)'" -o new-api.exe
|
||||||
|
|
||||||
|
- name: Update Electron version
|
||||||
|
run: |
|
||||||
|
cd electron
|
||||||
|
VERSION=$(git describe --tags)
|
||||||
|
VERSION=${VERSION#v} # Remove 'v' prefix if present
|
||||||
|
npm version $VERSION --no-git-tag-version --allow-same-version
|
||||||
|
|
||||||
- name: Install Electron dependencies
|
- name: Install Electron dependencies
|
||||||
run: |
|
run: |
|
||||||
cd electron
|
cd electron
|
||||||
npm install
|
npm install
|
||||||
|
|
||||||
- name: Build Electron app (macOS)
|
# - name: Build Electron app (macOS)
|
||||||
if: runner.os == 'macOS'
|
# if: runner.os == 'macOS'
|
||||||
run: |
|
# run: |
|
||||||
cd electron
|
# cd electron
|
||||||
npm run build:mac
|
# npm run build:mac
|
||||||
env:
|
# env:
|
||||||
CSC_IDENTITY_AUTO_DISCOVERY: false # Skip code signing
|
# CSC_IDENTITY_AUTO_DISCOVERY: false # Skip code signing
|
||||||
|
|
||||||
- name: Build Electron app (Windows)
|
- name: Build Electron app (Windows)
|
||||||
if: runner.os == 'Windows'
|
if: runner.os == 'Windows'
|
||||||
@ -66,14 +87,14 @@ jobs:
|
|||||||
cd electron
|
cd electron
|
||||||
npm run build:win
|
npm run build:win
|
||||||
|
|
||||||
- name: Upload artifacts (macOS)
|
# - name: Upload artifacts (macOS)
|
||||||
if: runner.os == 'macOS'
|
# if: runner.os == 'macOS'
|
||||||
uses: actions/upload-artifact@v4
|
# uses: actions/upload-artifact@v4
|
||||||
with:
|
# with:
|
||||||
name: macos-build
|
# name: macos-build
|
||||||
path: |
|
# path: |
|
||||||
electron/dist/*.dmg
|
# electron/dist/*.dmg
|
||||||
electron/dist/*.zip
|
# electron/dist/*.zip
|
||||||
|
|
||||||
- name: Upload artifacts (Windows)
|
- name: Upload artifacts (Windows)
|
||||||
if: runner.os == 'Windows'
|
if: runner.os == 'Windows'
|
||||||
@ -96,7 +117,7 @@ jobs:
|
|||||||
uses: softprops/action-gh-release@v1
|
uses: softprops/action-gh-release@v1
|
||||||
with:
|
with:
|
||||||
files: |
|
files: |
|
||||||
macos-build/*
|
# macos-build/*
|
||||||
windows-build/*
|
windows-build/*
|
||||||
draft: false
|
draft: false
|
||||||
prerelease: false
|
prerelease: false
|
||||||
|
|||||||
9
.github/workflows/linux-release.yml
vendored
9
.github/workflows/linux-release.yml
vendored
@ -38,21 +38,22 @@ jobs:
|
|||||||
- name: Build Backend (amd64)
|
- name: Build Backend (amd64)
|
||||||
run: |
|
run: |
|
||||||
go mod download
|
go mod download
|
||||||
go build -ldflags "-s -w -X 'one-api/common.Version=$(git describe --tags)' -extldflags '-static'" -o new-api
|
VERSION=$(git describe --tags)
|
||||||
|
go build -ldflags "-s -w -X 'one-api/common.Version=$VERSION' -extldflags '-static'" -o new-api-$VERSION
|
||||||
|
|
||||||
- name: Build Backend (arm64)
|
- name: Build Backend (arm64)
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
DEBIAN_FRONTEND=noninteractive sudo apt-get install -y gcc-aarch64-linux-gnu
|
DEBIAN_FRONTEND=noninteractive 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 new-api-arm64
|
VERSION=$(git describe --tags)
|
||||||
|
CC=aarch64-linux-gnu-gcc CGO_ENABLED=1 GOOS=linux GOARCH=arm64 go build -ldflags "-s -w -X 'one-api/common.Version=$VERSION' -extldflags '-static'" -o new-api-arm64-$VERSION
|
||||||
|
|
||||||
- name: Release
|
- name: Release
|
||||||
uses: softprops/action-gh-release@v1
|
uses: softprops/action-gh-release@v1
|
||||||
if: startsWith(github.ref, 'refs/tags/')
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
with:
|
with:
|
||||||
files: |
|
files: |
|
||||||
new-api
|
new-api-*
|
||||||
new-api-arm64
|
|
||||||
draft: true
|
draft: true
|
||||||
generate_release_notes: true
|
generate_release_notes: true
|
||||||
env:
|
env:
|
||||||
|
|||||||
5
.github/workflows/macos-release.yml
vendored
5
.github/workflows/macos-release.yml
vendored
@ -39,12 +39,13 @@ jobs:
|
|||||||
- name: Build Backend
|
- name: Build Backend
|
||||||
run: |
|
run: |
|
||||||
go mod download
|
go mod download
|
||||||
go build -ldflags "-X 'one-api/common.Version=$(git describe --tags)'" -o new-api-macos
|
VERSION=$(git describe --tags)
|
||||||
|
go build -ldflags "-X 'one-api/common.Version=$VERSION'" -o new-api-macos-$VERSION
|
||||||
- name: Release
|
- name: Release
|
||||||
uses: softprops/action-gh-release@v1
|
uses: softprops/action-gh-release@v1
|
||||||
if: startsWith(github.ref, 'refs/tags/')
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
with:
|
with:
|
||||||
files: new-api-macos
|
files: new-api-macos-*
|
||||||
draft: true
|
draft: true
|
||||||
generate_release_notes: true
|
generate_release_notes: true
|
||||||
env:
|
env:
|
||||||
|
|||||||
5
.github/workflows/windows-release.yml
vendored
5
.github/workflows/windows-release.yml
vendored
@ -41,12 +41,13 @@ jobs:
|
|||||||
- name: Build Backend
|
- name: Build Backend
|
||||||
run: |
|
run: |
|
||||||
go mod download
|
go mod download
|
||||||
go build -ldflags "-s -w -X 'one-api/common.Version=$(git describe --tags)'" -o new-api.exe
|
VERSION=$(git describe --tags)
|
||||||
|
go build -ldflags "-s -w -X 'one-api/common.Version=$VERSION'" -o new-api-$VERSION.exe
|
||||||
- name: Release
|
- name: Release
|
||||||
uses: softprops/action-gh-release@v1
|
uses: softprops/action-gh-release@v1
|
||||||
if: startsWith(github.ref, 'refs/tags/')
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
with:
|
with:
|
||||||
files: new-api.exe
|
files: new-api-*.exe
|
||||||
draft: true
|
draft: true
|
||||||
generate_release_notes: true
|
generate_release_notes: true
|
||||||
env:
|
env:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user