Update build.yml

This commit is contained in:
tidex 2025-02-15 21:30:39 +08:00 committed by GitHub
parent 07f6f05c87
commit 03cd055e6f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 6 deletions

View File

@ -2,18 +2,18 @@ name: Cross Build
on: on:
push: push:
branches: [ "main" ] # 触发分支 branches: [ "main" ]
pull_request: pull_request:
branches: [ "main" ] branches: [ "main" ]
workflow_dispatch: # 允许手动触发 workflow_dispatch:
jobs: jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: strategy:
matrix: matrix:
target_arch: # 定义目标架构列表 target_arch:
- "mipsle-softfloat" # MIPS 小端序软浮点 - "mipsle-softfloat"
steps: steps:
- name: Checkout Code - name: Checkout Code
uses: actions/checkout@v4 uses: actions/checkout@v4
@ -21,7 +21,7 @@ jobs:
- name: Set up Go - name: Set up Go
uses: actions/setup-go@v4 uses: actions/setup-go@v4
with: with:
go-version: '1.21' # 指定 Go 版本 go-version: '1.21'
- name: Install Dependencies - name: Install Dependencies
run: | run: |
@ -30,7 +30,8 @@ jobs:
- name: Build - name: Build
env: env:
GOARCH: ${{ matrix.target_arch.split('-')[0] }} # 使用 GitHub Actions 表达式语法分割字符串
GOARCH: ${{ fromJSON('["' + matrix.target_arch.split('-').join('","') + '"]')[0] }}
GOMIPS: ${{ contains(matrix.target_arch, 'mipsle') && 'softfloat' || '' }} GOMIPS: ${{ contains(matrix.target_arch, 'mipsle') && 'softfloat' || '' }}
CGO_ENABLED: 0 CGO_ENABLED: 0
run: | run: |