forked from Mxmilu666/frp
refactor(workflow): simplify build process and update steps
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
# 由于成本问题,现已全面转向 Github Actions 构建
|
||||||
name: Build FRP Binaries
|
name: Build FRP Binaries
|
||||||
|
|
||||||
on:
|
on:
|
||||||
@@ -7,29 +8,20 @@ on:
|
|||||||
tags:
|
tags:
|
||||||
- '**'
|
- '**'
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
tag:
|
||||||
|
description: 'Manual build tag'
|
||||||
|
required: false
|
||||||
|
default: 'manual'
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
name: Build FRP ${{ matrix.goos }}-${{ matrix.goarch }}
|
name: Build and Package FRP
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
goos: [linux, windows, darwin, freebsd, openbsd, android]
|
|
||||||
goarch: [amd64, arm, arm64]
|
|
||||||
exclude:
|
|
||||||
- goos: darwin
|
|
||||||
goarch: arm
|
|
||||||
- goos: freebsd
|
|
||||||
goarch: arm
|
|
||||||
- goos: openbsd
|
|
||||||
goarch: arm
|
|
||||||
- goos: android
|
|
||||||
goarch: amd64
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout source
|
- name: Checkout source
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
@@ -41,56 +33,18 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
go-version: '1.22'
|
go-version: '1.22'
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Set up dependencies
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get update -y
|
sudo apt-get update -y
|
||||||
sudo apt-get install -y zip tar make gcc g++ upx
|
sudo apt-get install -y zip make gcc g++ upx
|
||||||
|
|
||||||
- name: Build FRP for ${{ matrix.goos }}-${{ matrix.goarch }}
|
- name: Run build script
|
||||||
run: |
|
run: |
|
||||||
mkdir -p release/packages
|
chmod +x ./package.sh
|
||||||
|
./package.sh
|
||||||
|
|
||||||
echo "Building for ${{ matrix.goos }}-${{ matrix.goarch }}"
|
- name: Upload build artifacts
|
||||||
|
|
||||||
# 构建版本号
|
|
||||||
make
|
|
||||||
version=$(./bin/frps --version)
|
|
||||||
echo "Detected version: $version"
|
|
||||||
|
|
||||||
export GOOS=${{ matrix.goos }}
|
|
||||||
export GOARCH=${{ matrix.goarch }}
|
|
||||||
export CGO_ENABLED=0
|
|
||||||
|
|
||||||
# 构建可执行文件
|
|
||||||
make frpc frps
|
|
||||||
|
|
||||||
out_dir="release/packages/frp_${version}_${{ matrix.goos }}_${{ matrix.goarch }}"
|
|
||||||
mkdir -p "$out_dir"
|
|
||||||
|
|
||||||
if [ "${{ matrix.goos }}" = "windows" ]; then
|
|
||||||
mv ./bin/frpc.exe "$out_dir/frpc.exe"
|
|
||||||
mv ./bin/frps.exe "$out_dir/frps.exe"
|
|
||||||
else
|
|
||||||
mv ./bin/frpc "$out_dir/frpc"
|
|
||||||
mv ./bin/frps "$out_dir/frps"
|
|
||||||
fi
|
|
||||||
|
|
||||||
cp LICENSE "$out_dir"
|
|
||||||
cp -f conf/frpc.toml "$out_dir"
|
|
||||||
cp -f conf/frps.toml "$out_dir"
|
|
||||||
|
|
||||||
cd release/packages
|
|
||||||
if [ "${{ matrix.goos }}" = "windows" ]; then
|
|
||||||
zip -rq frp_${version}_${{ matrix.goos }}_${{ matrix.goarch }}.zip frp_${version}_${{ matrix.goos }}_${{ matrix.goarch }}
|
|
||||||
else
|
|
||||||
tar -zcf frp_${version}_${{ matrix.goos }}_${{ matrix.goarch }}.tar.gz frp_${version}_${{ matrix.goos }}_${{ matrix.goarch }}
|
|
||||||
fi
|
|
||||||
cd ../../
|
|
||||||
|
|
||||||
- name: Upload artifact
|
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: frp_${{ matrix.goos }}_${{ matrix.goarch }}
|
name: frp-packages
|
||||||
path: |
|
path: release/packages
|
||||||
release/packages/frp_*
|
|
||||||
retention-days: 7
|
|
||||||
Reference in New Issue
Block a user