From 03cd055e6fa3fcce7d72cebb18a2a87f21cfb36c Mon Sep 17 00:00:00 2001 From: tidex <46107860+tidexe@users.noreply.github.com> Date: Sat, 15 Feb 2025 21:30:39 +0800 Subject: [PATCH] Update build.yml --- .github/workflows/build.yml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 38356a07..a2a3056c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,18 +2,18 @@ name: Cross Build on: push: - branches: [ "main" ] # 触发分支 + branches: [ "main" ] pull_request: branches: [ "main" ] - workflow_dispatch: # 允许手动触发 + workflow_dispatch: jobs: build: runs-on: ubuntu-latest strategy: matrix: - target_arch: # 定义目标架构列表 - - "mipsle-softfloat" # MIPS 小端序软浮点 + target_arch: + - "mipsle-softfloat" steps: - name: Checkout Code uses: actions/checkout@v4 @@ -21,7 +21,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v4 with: - go-version: '1.21' # 指定 Go 版本 + go-version: '1.21' - name: Install Dependencies run: | @@ -30,7 +30,8 @@ jobs: - name: Build env: - GOARCH: ${{ matrix.target_arch.split('-')[0] }} + # 使用 GitHub Actions 表达式语法分割字符串 + GOARCH: ${{ fromJSON('["' + matrix.target_arch.split('-').join('","') + '"]')[0] }} GOMIPS: ${{ contains(matrix.target_arch, 'mipsle') && 'softfloat' || '' }} CGO_ENABLED: 0 run: |