mirror of
https://github.com/239573049/FastGateway.git
synced 2026-10-18 14:41:09 +08:00
ace59e5b36
- Introduced AppJsonContext for optimized JSON serialization with source generation. - Updated ResultFilter to handle EmptyHttpResult and EmptyResult correctly. - Refactored ClusterRequestFailoverMiddleware and ProxyErrorResponseMiddleware to use DTOs for error responses. - Modified ConfigurationService to utilize the new JSON context for configuration loading and saving. - Enhanced FileStorageService to return structured DTOs instead of anonymous objects. - Updated QpsService to return structured QPS data using DTOs. - Refactored RateLimitService to return structured error responses using DTOs. - Implemented SqlRunner for lightweight ADO.NET operations, replacing Dapper for compatibility with Native AOT. - Refactored Statistics services to utilize SqlRunner for database operations, ensuring type safety and explicit parameter binding. - Updated SystemService to return structured system information using DTOs. - Enhanced StreamForwardService to return structured data for port forwarding lists.
262 lines
7.7 KiB
YAML
262 lines
7.7 KiB
YAML
name: Release Build
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v*'
|
|
workflow_dispatch:
|
|
inputs:
|
|
version:
|
|
description: 'Release version (e.g., v1.0.0)'
|
|
required: true
|
|
type: string
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
env:
|
|
DOTNET_VERSION: '10.0.x'
|
|
# Tailwind CSS v4 ships a native (oxide) binding and requires Node 20+.
|
|
# Node 18 (npm 9) triggers the npm optional-dependency bug (npm/cli#4828).
|
|
NODE_VERSION: '20.x'
|
|
|
|
jobs:
|
|
build-web:
|
|
name: Build Web
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: ${{ env.NODE_VERSION }}
|
|
|
|
- name: Install dependencies
|
|
working-directory: web
|
|
run: npm install
|
|
|
|
- name: Build web
|
|
working-directory: web
|
|
run: npm run build
|
|
|
|
- name: Upload web artifacts
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: web-dist
|
|
path: web/dist/
|
|
retention-days: 1
|
|
|
|
build-tunnelclient:
|
|
name: Build TunnelClient
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- os: ubuntu-latest
|
|
runtime: linux-x64
|
|
arch: amd64
|
|
- os: ubuntu-latest
|
|
runtime: linux-arm64
|
|
arch: arm64
|
|
- os: windows-latest
|
|
runtime: win-x64
|
|
arch: amd64
|
|
- os: windows-latest
|
|
runtime: win-arm64
|
|
arch: arm64
|
|
- os: macos-latest
|
|
runtime: osx-x64
|
|
arch: amd64
|
|
- os: macos-latest
|
|
runtime: osx-arm64
|
|
arch: arm64
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup .NET
|
|
uses: actions/setup-dotnet@v4
|
|
with:
|
|
dotnet-version: ${{ env.DOTNET_VERSION }}
|
|
|
|
- name: Install dependencies
|
|
run: dotnet restore src/TunnelClient/TunnelClient.csproj
|
|
|
|
- name: Build TunnelClient
|
|
run: dotnet publish src/TunnelClient/TunnelClient.csproj -c Release -r ${{ matrix.runtime }} --self-contained true -p:PublishAot=false -p:PublishSingleFile=true -o ./artifacts/tunnelclient-${{ matrix.runtime }}
|
|
|
|
- name: Upload TunnelClient artifacts
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: tunnelclient-${{ matrix.runtime }}
|
|
path: ./artifacts/tunnelclient-${{ matrix.runtime }}/*
|
|
retention-days: 1
|
|
|
|
build-fastgateway:
|
|
name: Build FastGateway
|
|
needs: build-web
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- os: ubuntu-latest
|
|
runtime: linux-x64
|
|
arch: amd64
|
|
- os: ubuntu-latest
|
|
runtime: linux-arm64
|
|
arch: arm64
|
|
- os: windows-latest
|
|
runtime: win-x64
|
|
arch: amd64
|
|
- os: windows-latest
|
|
runtime: win-arm64
|
|
arch: arm64
|
|
- os: macos-latest
|
|
runtime: osx-x64
|
|
arch: amd64
|
|
- os: macos-latest
|
|
runtime: osx-arm64
|
|
arch: arm64
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Download web artifacts
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: web-dist
|
|
path: src/FastGateway/wwwroot
|
|
|
|
- name: Setup .NET
|
|
uses: actions/setup-dotnet@v4
|
|
with:
|
|
dotnet-version: ${{ env.DOTNET_VERSION }}
|
|
|
|
- name: Install dependencies
|
|
run: dotnet restore src/FastGateway/FastGateway.csproj
|
|
|
|
- name: Build FastGateway
|
|
run: dotnet publish src/FastGateway/FastGateway.csproj -c Release -r ${{ matrix.runtime }} --self-contained true -p:PublishSingleFile=true -p:PublishAot=false -o ./artifacts/fastgateway-${{ matrix.runtime }}
|
|
|
|
- name: Upload FastGateway artifacts
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: fastgateway-${{ matrix.runtime }}
|
|
path: ./artifacts/fastgateway-${{ matrix.runtime }}/*
|
|
retention-days: 1
|
|
|
|
create-release:
|
|
name: Create Release
|
|
needs: [build-tunnelclient, build-fastgateway]
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Download all artifacts
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
path: ./artifacts
|
|
|
|
- name: Prepare release assets
|
|
run: |
|
|
mkdir -p release-assets
|
|
|
|
# Create archives for each platform
|
|
cd artifacts
|
|
|
|
# TunnelClient archives
|
|
for dir in tunnelclient-*; do
|
|
if [[ -d "$dir" ]]; then
|
|
runtime=$(echo $dir | sed 's/tunnelclient-//')
|
|
if [[ "$runtime" == win-* ]]; then
|
|
(cd "$dir" && zip -r "../../release-assets/tunnelclient-${runtime}.zip" .)
|
|
else
|
|
tar -czf "../release-assets/tunnelclient-${runtime}.tar.gz" -C "$dir" .
|
|
fi
|
|
fi
|
|
done
|
|
|
|
# FastGateway archives
|
|
for dir in fastgateway-*; do
|
|
if [[ -d "$dir" ]]; then
|
|
runtime=$(echo $dir | sed 's/fastgateway-//')
|
|
if [[ "$runtime" == win-* ]]; then
|
|
(cd "$dir" && zip -r "../../release-assets/fastgateway-${runtime}.zip" .)
|
|
else
|
|
tar -czf "../release-assets/fastgateway-${runtime}.tar.gz" -C "$dir" .
|
|
fi
|
|
fi
|
|
done
|
|
|
|
- name: Generate release notes
|
|
run: |
|
|
cat > release-notes.md << 'EOF'
|
|
## Release ${{ github.ref_name || github.event.inputs.version }}
|
|
|
|
### Downloads
|
|
|
|
#### FastGateway
|
|
- **Linux x64**: `fastgateway-linux-x64.tar.gz`
|
|
- **Linux ARM64**: `fastgateway-linux-arm64.tar.gz`
|
|
- **Windows x64**: `fastgateway-win-x64.zip`
|
|
- **Windows ARM64**: `fastgateway-win-arm64.zip`
|
|
- **macOS x64 (Intel)**: `fastgateway-osx-x64.tar.gz`
|
|
- **macOS ARM64 (Apple Silicon)**: `fastgateway-osx-arm64.tar.gz`
|
|
|
|
#### TunnelClient
|
|
- **Linux x64**: `tunnelclient-linux-x64.tar.gz`
|
|
- **Linux ARM64**: `tunnelclient-linux-arm64.tar.gz`
|
|
- **Windows x64**: `tunnelclient-win-x64.zip`
|
|
- **Windows ARM64**: `tunnelclient-win-arm64.zip`
|
|
- **macOS x64 (Intel)**: `tunnelclient-osx-x64.tar.gz`
|
|
- **macOS ARM64 (Apple Silicon)**: `tunnelclient-osx-arm64.tar.gz`
|
|
|
|
### Features
|
|
- Cross-platform support for Linux, Windows and macOS
|
|
- x64 and ARM64 architecture support
|
|
- TunnelClient: Single-file executable for optimal portability
|
|
- FastGateway: Single-file executable with all dependencies included
|
|
|
|
### Usage
|
|
|
|
#### TunnelClient
|
|
```bash
|
|
# Linux/macOS
|
|
./tunnelclient
|
|
|
|
# Windows
|
|
tunnelclient.exe
|
|
```
|
|
|
|
#### FastGateway
|
|
```bash
|
|
# Linux/macOS
|
|
./fastgateway
|
|
|
|
# Windows
|
|
fastgateway.exe
|
|
```
|
|
EOF
|
|
|
|
- name: Create Release
|
|
uses: softprops/action-gh-release@v2
|
|
if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch'
|
|
with:
|
|
name: Release ${{ github.ref_name || github.event.inputs.version }}
|
|
body_path: release-notes.md
|
|
files: release-assets/*
|
|
tag_name: ${{ github.ref_name || github.event.inputs.version }}
|
|
target_commitish: ${{ github.sha }}
|
|
draft: false
|
|
prerelease: false
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |