cloudflared-mirror/.github/workflows/build-release.yml

90 lines
2.3 KiB
YAML

name: Cross Build and Release
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
workflow_dispatch:
jobs:
setup:
runs-on: ubuntu-latest
strategy:
matrix:
target_arch:
- "mipsle-softfloat"
- "mipsle-hardfloat"
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.21'
- name: Install Dependencies
run: |
sudo apt-get update
sudo apt-get install -y gcc-mips-linux-gnu gcc-arm-linux-gnueabihf
build:
runs-on: ubuntu-latest
needs: setup
strategy:
matrix:
target_arch:
- "mipsle-softfloat"
- "mipsle-hardfloat"
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Build
env:
GOARCH: ${{ contains(matrix.target_arch, 'mipsle') && 'mipsle' || '' }}
GOMIPS: ${{ contains(matrix.target_arch, 'softfloat') && 'softfloat' || 'hardfloat' }}
CGO_ENABLED: 0
run: |
echo "Building for GOARCH=${GOARCH} GOMIPS=${GOMIPS}"
GOOS=linux go build -v -ldflags '-s -w' -o cloudflared-${{ matrix.target_arch }} ./cmd/cloudflared
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: cloudflared-${{ matrix.target_arch }}
path: cloudflared-${{ matrix.target_arch }}
release:
runs-on: ubuntu-latest
needs: build
strategy:
matrix:
target_arch:
- "mipsle-softfloat"
- "mipsle-hardfloat"
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Download Artifact
uses: actions/download-artifact@v4
with:
name: cloudflared-${{ matrix.target_arch }}
path: .
- name: Generate SHA Sums
run: |
echo "Generating SHA sums for release assets..."
sha256sum cloudflared-${{ matrix.target_arch }} > SHA256_SUMS
cat SHA256_SUMS
- name: Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
cloudflared-${{ matrix.target_arch }}
SHA256_SUMS