mirror of
https://github.com/OwO-Network/DeepLX.git
synced 2026-06-11 15:28:50 +00:00
ci(release): build cross-platform binaries in parallel via matrix (#226)
The release job ran .cross_compile.sh, which builds all 12 targets sequentially in a single runner. Split the build into a matrix so each GOOS/GOARCH pair builds concurrently on its own runner, then a dependent Release job collects the artifacts and publishes them in one release. Output filenames are unchanged.
This commit is contained in:
parent
9d6b294a61
commit
231393c669
53
.github/workflows/release.yaml
vendored
53
.github/workflows/release.yaml
vendored
@ -5,11 +5,28 @@ on:
|
|||||||
pull_request:
|
pull_request:
|
||||||
|
|
||||||
name: Release
|
name: Release
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|
||||||
Build:
|
Build:
|
||||||
if: startsWith(github.ref, 'refs/tags/v')
|
if: startsWith(github.ref, 'refs/tags/v')
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- { goos: darwin, goarch: amd64 }
|
||||||
|
- { goos: darwin, goarch: arm64 }
|
||||||
|
- { goos: linux, goarch: '386' }
|
||||||
|
- { goos: linux, goarch: amd64 }
|
||||||
|
- { goos: linux, goarch: arm64 }
|
||||||
|
- { goos: linux, goarch: mips }
|
||||||
|
- { goos: openbsd, goarch: amd64 }
|
||||||
|
- { goos: openbsd, goarch: arm64 }
|
||||||
|
- { goos: freebsd, goarch: amd64 }
|
||||||
|
- { goos: freebsd, goarch: arm64 }
|
||||||
|
- { goos: windows, goarch: '386' }
|
||||||
|
- { goos: windows, goarch: amd64 }
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
@ -17,12 +34,40 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
go-version: "1.24.2"
|
go-version: "1.24.2"
|
||||||
|
|
||||||
- run: bash .cross_compile.sh
|
- name: Build
|
||||||
|
env:
|
||||||
|
GOOS: ${{ matrix.goos }}
|
||||||
|
GOARCH: ${{ matrix.goarch }}
|
||||||
|
CGO_ENABLED: "0"
|
||||||
|
run: |
|
||||||
|
mkdir -p dist
|
||||||
|
BINARY="dist/deeplx_${GOOS}_${GOARCH}"
|
||||||
|
if [ "${GOOS}" = "windows" ]; then
|
||||||
|
BINARY="${BINARY}.exe"
|
||||||
|
fi
|
||||||
|
go build -trimpath -ldflags "-w -s" -o "${BINARY}" .
|
||||||
|
|
||||||
|
- name: Upload artifact
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: deeplx_${{ matrix.goos }}_${{ matrix.goarch }}
|
||||||
|
path: dist/*
|
||||||
|
if-no-files-found: error
|
||||||
|
|
||||||
|
Release:
|
||||||
|
needs: Build
|
||||||
|
if: startsWith(github.ref, 'refs/tags/v')
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Download artifacts
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
path: dist
|
||||||
|
merge-multiple: true
|
||||||
|
|
||||||
- name: Release
|
- name: Release
|
||||||
uses: softprops/action-gh-release@v1
|
uses: softprops/action-gh-release@v1
|
||||||
with:
|
with:
|
||||||
draft: false
|
draft: false
|
||||||
generate_release_notes: true
|
generate_release_notes: true
|
||||||
files: |
|
files: dist/*
|
||||||
dist/*
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user