ci: add darwin build matrix for macos offline deployment

This commit is contained in:
Haitao Pan 2026-06-19 19:06:50 +08:00
parent 6a405a00e5
commit 9a8dd2dfe1

View File

@ -19,11 +19,12 @@ concurrency:
jobs: jobs:
build: build:
name: Build linux-${{ matrix.arch }} name: Build ${{ matrix.os }}-${{ matrix.arch }}
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [linux, darwin]
arch: [amd64, arm64] arch: [amd64, arm64]
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
@ -38,12 +39,13 @@ jobs:
- name: Build runtime asset - name: Build runtime asset
env: env:
TARGET_OS: ${{ matrix.os }}
TARGET_ARCH: ${{ matrix.arch }} TARGET_ARCH: ${{ matrix.arch }}
run: | run: |
set -euo pipefail set -euo pipefail
root="dist/runtime/xworkmate-bridge" root="dist/runtime/xworkmate-bridge"
mkdir -p "${root}/bin" dist/assets mkdir -p "${root}/bin" dist/assets
CGO_ENABLED=0 GOOS=linux GOARCH="${TARGET_ARCH}" \ CGO_ENABLED=0 GOOS="${TARGET_OS}" GOARCH="${TARGET_ARCH}" \
go build -buildvcs=false -trimpath \ go build -buildvcs=false -trimpath \
-ldflags "-X main.buildCommit=${GITHUB_SHA}" \ -ldflags "-X main.buildCommit=${GITHUB_SHA}" \
-o "${root}/bin/xworkmate-go-core" . -o "${root}/bin/xworkmate-go-core" .
@ -51,12 +53,12 @@ jobs:
{ {
"component": "xworkmate-bridge", "component": "xworkmate-bridge",
"commit": "${GITHUB_SHA}", "commit": "${GITHUB_SHA}",
"os": "linux", "os": "${TARGET_OS}",
"arch": "${TARGET_ARCH}", "arch": "${TARGET_ARCH}",
"binary": "bin/xworkmate-go-core" "binary": "bin/xworkmate-go-core"
} }
JSON JSON
tar -czf "dist/assets/xworkmate-bridge-linux-${TARGET_ARCH}.tar.gz" \ tar -czf "dist/assets/xworkmate-bridge-${TARGET_OS}-${TARGET_ARCH}.tar.gz" \
-C dist/runtime xworkmate-bridge -C dist/runtime xworkmate-bridge
( (
cd dist/assets cd dist/assets
@ -65,7 +67,7 @@ jobs:
- uses: actions/upload-artifact@v4 - uses: actions/upload-artifact@v4
with: with:
name: xworkmate-bridge-linux-${{ matrix.arch }} name: xworkmate-bridge-${{ matrix.os }}-${{ matrix.arch }}
path: | path: |
dist/assets/*.tar.gz dist/assets/*.tar.gz
dist/assets/SHA256SUMS-* dist/assets/SHA256SUMS-*
@ -77,7 +79,7 @@ jobs:
steps: steps:
- uses: actions/download-artifact@v4 - uses: actions/download-artifact@v4
with: with:
pattern: xworkmate-bridge-linux-* pattern: xworkmate-bridge-*
path: dist path: dist
merge-multiple: true merge-multiple: true
@ -97,5 +99,5 @@ jobs:
--repo "${GITHUB_REPOSITORY}" \ --repo "${GITHUB_REPOSITORY}" \
--target "${GITHUB_SHA}" \ --target "${GITHUB_SHA}" \
--title "XWorkmate Bridge runtime ${GITHUB_SHA::12}" \ --title "XWorkmate Bridge runtime ${GITHUB_SHA::12}" \
--notes "Prebuilt Linux bridge binaries. No target-host Go build is required." --notes "Prebuilt bridge binaries. No target-host Go build is required."
fi fi