Update build-release.yml

This commit is contained in:
tidex 2025-02-20 06:08:33 +08:00 committed by GitHub
parent 9bc5d005f6
commit 71926b255f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 13 additions and 6 deletions

View File

@ -28,39 +28,46 @@ jobs:
run: | run: |
sudo apt-get update sudo apt-get update
sudo apt-get install -y gcc-mips-linux-gnu gcc-arm-linux-gnueabihf sudo apt-get install -y gcc-mips-linux-gnu gcc-arm-linux-gnueabihf
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: setup
strategy: strategy:
matrix: matrix:
target_arch: target_arch:
- "mipsle-softfloat" - "mipsle-softfloat"
- "mipsle-hardfloat" - "mipsle-hardfloat"
steps: steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Build - name: Build
env: env:
# 直接基于已知格式设置 GOARCH 和 GOMIPS
GOARCH: ${{ contains(matrix.target_arch, 'mipsle') && 'mipsle' || '' }} GOARCH: ${{ contains(matrix.target_arch, 'mipsle') && 'mipsle' || '' }}
GOMIPS: ${{ contains(matrix.target_arch, 'softfloat') && 'softfloat' || 'hardfloat' }} GOMIPS: ${{ contains(matrix.target_arch, 'softfloat') && 'softfloat' || 'hardfloat' }}
CGO_ENABLED: 0 CGO_ENABLED: 0
run: | run: |
echo "Building for GOARCH=${GOARCH} GOMIPS=${GOMIPS}" echo "Building for GOARCH=${GOARCH} GOMIPS=${GOMIPS}"
GOOS=linux go build -v -ldflags '-s -w' -o cloudflared-${{ matrix.target_arch }} ./cmd/cloudflared GOOS=linux go build -v -ldflags '-s -w' -o cloudflared-${{ matrix.target_arch }} ./cmd/cloudflared
release: release:
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: build
strategy: strategy:
matrix: matrix:
target_arch: target_arch:
- "mipsle-softfloat" - "mipsle-softfloat"
- "mipsle-hardfloat" - "mipsle-hardfloat"
steps: steps:
- name: Checkout - name: Checkout Code
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Generate SHA Sums - name: Generate SHA Sums
run: | run: |
# 创建一个文件来存储 SHA 哈希值
echo "Generating SHA sums for release assets..." echo "Generating SHA sums for release assets..."
sha256sum cloudflared-${{ matrix.target_arch }} > SHA256_SUMS sha256sum cloudflared-${{ matrix.target_arch }} > SHA256_SUMS
cat SHA256_SUMS # 打印生成的 SHA 哈希值 cat SHA256_SUMS
- name: Release - name: Release
uses: softprops/action-gh-release@v2 uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/') if: startsWith(github.ref, 'refs/tags/')