ci: 更新工作流文件引用
- 删除了 build.yml 文件,移除了旧的编译流程 - 在 sync-upstream.yml 中更新了工作流引用,使用新的 build-release.yml
This commit is contained in:
parent
0f436e3754
commit
9bc5d005f6
|
|
@ -0,0 +1,69 @@
|
||||||
|
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
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
target_arch:
|
||||||
|
- "mipsle-softfloat"
|
||||||
|
- "mipsle-hardfloat"
|
||||||
|
steps:
|
||||||
|
- name: Build
|
||||||
|
env:
|
||||||
|
# 直接基于已知格式设置 GOARCH 和 GOMIPS
|
||||||
|
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
|
||||||
|
release:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
target_arch:
|
||||||
|
- "mipsle-softfloat"
|
||||||
|
- "mipsle-hardfloat"
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Generate SHA Sums
|
||||||
|
run: |
|
||||||
|
# 创建一个文件来存储 SHA 哈希值
|
||||||
|
echo "Generating SHA sums for release assets..."
|
||||||
|
sha256sum cloudflared-${{ matrix.target_arch }} > SHA256_SUMS
|
||||||
|
cat SHA256_SUMS # 打印生成的 SHA 哈希值
|
||||||
|
- name: Release
|
||||||
|
uses: softprops/action-gh-release@v2
|
||||||
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
|
with:
|
||||||
|
files: |
|
||||||
|
SHA256_SUMS
|
||||||
|
|
@ -1,62 +0,0 @@
|
||||||
name: Cross Build
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: [ "main" ]
|
|
||||||
pull_request:
|
|
||||||
branches: [ "main" ]
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
target_arch:
|
|
||||||
- "mipsle-softfloat"
|
|
||||||
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
|
|
||||||
|
|
||||||
- name: Build
|
|
||||||
env:
|
|
||||||
# 直接基于已知格式设置 GOARCH 和 GOMIPS
|
|
||||||
GOARCH: ${{ contains(matrix.target_arch, 'mipsle') && 'mipsle' || '' }}
|
|
||||||
GOMIPS: ${{ contains(matrix.target_arch, 'softfloat') && 'softfloat' || '' }}
|
|
||||||
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 }}
|
|
||||||
|
|
||||||
- name: Upload Release Assets
|
|
||||||
uses: actions/upload-release-asset@v1
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.TOKEN }}
|
|
||||||
with:
|
|
||||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
||||||
asset_path: ./artifacts/cloudflared-${{ matrix.target_arch }}
|
|
||||||
asset_name: cloudflared-${{ matrix.target_arch }}
|
|
||||||
asset_content_type: application/octet-stream
|
|
||||||
|
|
||||||
- name: Trigger Release Workflow
|
|
||||||
if: success()
|
|
||||||
uses: benc-uk/workflow-dispatch@v1
|
|
||||||
with:
|
|
||||||
workflow: create-release.yml # 你的发布工作流文件名
|
|
||||||
token: ${{ secrets.TOKEN }}
|
|
||||||
|
|
@ -36,5 +36,5 @@ jobs:
|
||||||
- name: Trigger Build Workflow
|
- name: Trigger Build Workflow
|
||||||
uses: benc-uk/workflow-dispatch@v1
|
uses: benc-uk/workflow-dispatch@v1
|
||||||
with:
|
with:
|
||||||
workflow: build.yml # 你的编译工作流文件名
|
workflow: build-release.yml # 你的编译工作流文件名
|
||||||
token: ${{ secrets.TOKEN }}
|
token: ${{ secrets.TOKEN }}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue