mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-10-08 00:26:37 +08:00
feat: 重构发布工作流,合并 macOS 和 Windows 发布配置,优化 Node.js 和 Go 版本设置
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
name: Linux Release
|
name: Server Release
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
|
|
||||||
@@ -6,46 +6,113 @@ on:
|
|||||||
push:
|
push:
|
||||||
tags:
|
tags:
|
||||||
- "*"
|
- "*"
|
||||||
|
|
||||||
|
env:
|
||||||
|
VERSION: ${{ github.ref_name }}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
release:
|
build-frontend:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- uses: actions/setup-node@v3
|
|
||||||
|
- name: Set up Node.js
|
||||||
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: 16
|
node-version: 18
|
||||||
|
|
||||||
- name: Build Frontend
|
- name: Build Frontend
|
||||||
env:
|
env:
|
||||||
CI: ""
|
CI: ""
|
||||||
run: |
|
run: |
|
||||||
cd atsf_server/web
|
cd atsf_server/web
|
||||||
npm install
|
npm install
|
||||||
REACT_APP_VERSION=$(git describe --tags) npm run build
|
REACT_APP_VERSION="$VERSION" npm run build
|
||||||
cd ../..
|
|
||||||
- name: Set up Go
|
- name: Upload Frontend Artifact
|
||||||
uses: actions/setup-go@v3
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
go-version: ">=1.18.0"
|
name: frontend-build
|
||||||
- name: Build Server (amd64)
|
path: atsf_server/web/build
|
||||||
|
retention-days: 1
|
||||||
|
|
||||||
|
build-binaries:
|
||||||
|
needs: build-frontend
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- goos: linux
|
||||||
|
goarch: amd64
|
||||||
|
asset_name: atsflare-server-linux-amd64
|
||||||
|
- goos: linux
|
||||||
|
goarch: arm64
|
||||||
|
asset_name: atsflare-server-linux-arm64
|
||||||
|
- goos: darwin
|
||||||
|
goarch: amd64
|
||||||
|
asset_name: atsflare-server-darwin-amd64
|
||||||
|
- goos: darwin
|
||||||
|
goarch: arm64
|
||||||
|
asset_name: atsflare-server-darwin-arm64
|
||||||
|
- goos: windows
|
||||||
|
goarch: amd64
|
||||||
|
asset_name: atsflare-server-windows-amd64.exe
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Download Frontend Artifact
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
name: frontend-build
|
||||||
|
path: atsf_server/web/build
|
||||||
|
|
||||||
|
- name: Set up Go
|
||||||
|
uses: actions/setup-go@v5
|
||||||
|
with:
|
||||||
|
go-version-file: atsf_server/go.mod
|
||||||
|
|
||||||
|
- name: Build Server
|
||||||
working-directory: atsf_server
|
working-directory: atsf_server
|
||||||
|
env:
|
||||||
|
CGO_ENABLED: 0
|
||||||
|
GOOS: ${{ matrix.goos }}
|
||||||
|
GOARCH: ${{ matrix.goarch }}
|
||||||
|
ASSET_NAME: ${{ matrix.asset_name }}
|
||||||
run: |
|
run: |
|
||||||
go mod download
|
go mod download
|
||||||
go build -ldflags "-s -w -X 'atsflare/common.Version=$(git describe --tags)' -extldflags '-static'" -o ../atsflare
|
mkdir -p ../dist
|
||||||
|
go build -trimpath -ldflags "-s -w -X 'atsflare/common.Version=$VERSION'" -o "../dist/$ASSET_NAME" .
|
||||||
|
|
||||||
- name: Build Server (arm64)
|
- name: Upload Binary Artifact
|
||||||
working-directory: atsf_server
|
uses: actions/upload-artifact@v4
|
||||||
run: |
|
with:
|
||||||
sudo apt-get update
|
name: server-${{ matrix.goos }}-${{ matrix.goarch }}
|
||||||
sudo apt-get install gcc-aarch64-linux-gnu
|
path: dist/${{ matrix.asset_name }}
|
||||||
CC=aarch64-linux-gnu-gcc CGO_ENABLED=1 GOOS=linux GOARCH=arm64 go build -ldflags "-s -w -X 'atsflare/common.Version=$(git describe --tags)' -extldflags '-static'" -o ../atsflare-arm64
|
retention-days: 1
|
||||||
|
|
||||||
|
release:
|
||||||
|
needs: build-binaries
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Download Binary Artifacts
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
pattern: server-*
|
||||||
|
path: dist
|
||||||
|
merge-multiple: true
|
||||||
|
|
||||||
- name: Determine prerelease
|
- name: Determine prerelease
|
||||||
id: prerelease
|
id: prerelease
|
||||||
run: |
|
run: |
|
||||||
TAG="${GITHUB_REF#refs/tags/}"
|
TAG="$VERSION"
|
||||||
if [[ "$TAG" == *alpha* ]] || [[ "$TAG" == *beta* ]] || [[ "$TAG" == *rc* ]]; then
|
if [[ "$TAG" == *alpha* ]] || [[ "$TAG" == *beta* ]] || [[ "$TAG" == *rc* ]]; then
|
||||||
echo "is_prerelease=true" >> "$GITHUB_OUTPUT"
|
echo "is_prerelease=true" >> "$GITHUB_OUTPUT"
|
||||||
else
|
else
|
||||||
@@ -56,9 +123,7 @@ jobs:
|
|||||||
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: dist/*
|
||||||
atsflare
|
|
||||||
atsflare-arm64
|
|
||||||
draft: false
|
draft: false
|
||||||
prerelease: ${{ steps.prerelease.outputs.is_prerelease }}
|
prerelease: ${{ steps.prerelease.outputs.is_prerelease }}
|
||||||
generate_release_notes: true
|
generate_release_notes: true
|
||||||
|
|||||||
@@ -1,45 +0,0 @@
|
|||||||
name: macOS Release
|
|
||||||
permissions:
|
|
||||||
contents: write
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
tags:
|
|
||||||
- '*'
|
|
||||||
- '!*-alpha*'
|
|
||||||
jobs:
|
|
||||||
release:
|
|
||||||
runs-on: macos-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
- uses: actions/setup-node@v3
|
|
||||||
with:
|
|
||||||
node-version: 16
|
|
||||||
- name: Build Frontend
|
|
||||||
env:
|
|
||||||
CI: ""
|
|
||||||
run: |
|
|
||||||
cd web
|
|
||||||
npm install
|
|
||||||
REACT_APP_VERSION=$(git describe --tags) npm run build
|
|
||||||
cd ..
|
|
||||||
- name: Set up Go
|
|
||||||
uses: actions/setup-go@v3
|
|
||||||
with:
|
|
||||||
go-version: '>=1.18.0'
|
|
||||||
- name: Build Backend
|
|
||||||
run: |
|
|
||||||
go mod download
|
|
||||||
go build -ldflags "-X 'atsflare/common.Version=$(git describe --tags)'" -o atsflare-macos
|
|
||||||
- name: Release
|
|
||||||
uses: softprops/action-gh-release@v1
|
|
||||||
if: startsWith(github.ref, 'refs/tags/')
|
|
||||||
with:
|
|
||||||
files: atsflare-macos
|
|
||||||
draft: false
|
|
||||||
generate_release_notes: true
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
@@ -1,48 +0,0 @@
|
|||||||
name: Windows Release
|
|
||||||
permissions:
|
|
||||||
contents: write
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
tags:
|
|
||||||
- '*'
|
|
||||||
- '!*-alpha*'
|
|
||||||
jobs:
|
|
||||||
release:
|
|
||||||
runs-on: windows-latest
|
|
||||||
defaults:
|
|
||||||
run:
|
|
||||||
shell: bash
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
- uses: actions/setup-node@v3
|
|
||||||
with:
|
|
||||||
node-version: 16
|
|
||||||
- name: Build Frontend
|
|
||||||
env:
|
|
||||||
CI: ""
|
|
||||||
run: |
|
|
||||||
cd web
|
|
||||||
npm install
|
|
||||||
REACT_APP_VERSION=$(git describe --tags) npm run build
|
|
||||||
cd ..
|
|
||||||
- name: Set up Go
|
|
||||||
uses: actions/setup-go@v3
|
|
||||||
with:
|
|
||||||
go-version: '>=1.18.0'
|
|
||||||
- name: Build Backend
|
|
||||||
run: |
|
|
||||||
go mod download
|
|
||||||
go build -ldflags "-s -w -X 'atsflare/common.Version=$(git describe --tags)'" -o atsflare.exe
|
|
||||||
- name: Release
|
|
||||||
uses: softprops/action-gh-release@v1
|
|
||||||
if: startsWith(github.ref, 'refs/tags/')
|
|
||||||
with:
|
|
||||||
files: atsflare.exe
|
|
||||||
draft: false
|
|
||||||
generate_release_notes: true
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
Reference in New Issue
Block a user