From 465e5e55e2d74f797bdebe9342983d885006e7eb Mon Sep 17 00:00:00 2001 From: loecom <154944277+loecom@users.noreply.github.com> Date: Sun, 8 Jun 2025 07:37:49 +0800 Subject: [PATCH 01/24] Create build.yml --- .github/workflows/build.yml | 60 +++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..bce9be1 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,60 @@ +name: Build FastGithub + +on: + push: + branches: [ main, master ] + pull_request: + branches: [ main, master ] + release: + types: [ published ] + +jobs: + build: + runs-on: windows-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: | + 6.0.x + 7.0.x + + - name: Restore dependencies + run: dotnet restore FastGithub.sln + + - name: Build solution + run: dotnet build FastGithub.sln --configuration Release --no-restore + + - name: Publish FastGithub + run: | + dotnet publish FastGithub/FastGithub.csproj -c Release -o ./publish/fastgithub --self-contained true -r win-x64 --single-file + dotnet publish FastGithub/FastGithub.csproj -c Release -o ./publish/fastgithub-linux --self-contained true -r linux-x64 --single-file + dotnet publish FastGithub/FastGithub.csproj -c Release -o ./publish/fastgithub-osx --self-contained true -r osx-x64 --single-file + + - name: Build UI (Windows only) + run: | + msbuild FastGithub.UI/FastGithub.UI.csproj /p:Configuration=Release /p:Platform="Any CPU" + + - name: Upload Windows artifacts + uses: actions/upload-artifact@v4 + with: + name: fastgithub-windows + path: | + ./publish/fastgithub/ + FastGithub.UI/bin/Release/ + + - name: Upload Linux artifacts + uses: actions/upload-artifact@v4 + with: + name: fastgithub-linux + path: ./publish/fastgithub-linux/ + + - name: Upload macOS artifacts + uses: actions/upload-artifact@v4 + with: + name: fastgithub-osx + path: ./publish/fastgithub-osx/ From dcbd71497b096aa5d63ee01e972ecda2220e1d0c Mon Sep 17 00:00:00 2001 From: loecom <154944277+loecom@users.noreply.github.com> Date: Sun, 8 Jun 2025 07:44:10 +0800 Subject: [PATCH 02/24] Update build.yml --- .github/workflows/build.yml | 29 ++++++++--------------------- 1 file changed, 8 insertions(+), 21 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bce9be1..3a9788e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -20,8 +20,7 @@ jobs: uses: actions/setup-dotnet@v4 with: dotnet-version: | - 6.0.x - 7.0.x + 8.0.x - name: Restore dependencies run: dotnet restore FastGithub.sln @@ -31,30 +30,18 @@ jobs: - name: Publish FastGithub run: | - dotnet publish FastGithub/FastGithub.csproj -c Release -o ./publish/fastgithub --self-contained true -r win-x64 --single-file - dotnet publish FastGithub/FastGithub.csproj -c Release -o ./publish/fastgithub-linux --self-contained true -r linux-x64 --single-file - dotnet publish FastGithub/FastGithub.csproj -c Release -o ./publish/fastgithub-osx --self-contained true -r osx-x64 --single-file + dotnet publish FastGithub/FastGithub.csproj -c Release -o ./publish/fastgithub --self-contained true -r win-x64 -p:PublishSingleFile=true + dotnet publish FastGithub/FastGithub.csproj -c Release -o ./publish/fastgithub-linux --self-contained true -r linux-x64 -p:PublishSingleFile=true + dotnet publish FastGithub/FastGithub.csproj -c Release -o ./publish/fastgithub-osx --self-contained true -r osx-x64 -p:PublishSingleFile=true - name: Build UI (Windows only) run: | msbuild FastGithub.UI/FastGithub.UI.csproj /p:Configuration=Release /p:Platform="Any CPU" - - name: Upload Windows artifacts + - name: Upload artifacts uses: actions/upload-artifact@v4 with: - name: fastgithub-windows + name: fastgithub-all-platforms path: | - ./publish/fastgithub/ - FastGithub.UI/bin/Release/ - - - name: Upload Linux artifacts - uses: actions/upload-artifact@v4 - with: - name: fastgithub-linux - path: ./publish/fastgithub-linux/ - - - name: Upload macOS artifacts - uses: actions/upload-artifact@v4 - with: - name: fastgithub-osx - path: ./publish/fastgithub-osx/ + ./publish/ + FastGithub.UI/bin/Release/ From 4e30e44dfab2fac0966f06ab6c94c235ffcb04ef Mon Sep 17 00:00:00 2001 From: loecom <154944277+loecom@users.noreply.github.com> Date: Sun, 8 Jun 2025 13:00:29 +0800 Subject: [PATCH 03/24] Update build.yml --- .github/workflows/build.yml | 56 ++++++++++++++++++++++--------------- 1 file changed, 33 insertions(+), 23 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3a9788e..d6ce1d5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -5,43 +5,53 @@ on: branches: [ main, master ] pull_request: branches: [ main, master ] - release: - types: [ published ] jobs: build: - runs-on: windows-latest + runs-on: ubuntu-latest steps: - - name: Checkout code - uses: actions/checkout@v4 - + - uses: actions/checkout@v4 + - name: Setup .NET uses: actions/setup-dotnet@v4 with: - dotnet-version: | - 8.0.x - + dotnet-version: '7.0.x' + - name: Restore dependencies run: dotnet restore FastGithub.sln - - - name: Build solution - run: dotnet build FastGithub.sln --configuration Release --no-restore - - - name: Publish FastGithub + + - name: Build + run: dotnet build FastGithub.sln --no-restore --configuration Release + + - name: Test + run: dotnet test FastGithub.sln --no-build --configuration Release --verbosity normal + + build-multi-platform: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + + steps: + - uses: actions/checkout@v4 + + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: '7.0.x' + + - name: Build for ${{ matrix.os }} run: | - dotnet publish FastGithub/FastGithub.csproj -c Release -o ./publish/fastgithub --self-contained true -r win-x64 -p:PublishSingleFile=true - dotnet publish FastGithub/FastGithub.csproj -c Release -o ./publish/fastgithub-linux --self-contained true -r linux-x64 -p:PublishSingleFile=true - dotnet publish FastGithub/FastGithub.csproj -c Release -o ./publish/fastgithub-osx --self-contained true -r osx-x64 -p:PublishSingleFile=true + dotnet restore FastGithub.sln + dotnet build FastGithub.sln --configuration Release - - name: Build UI (Windows only) + - name: Publish artifacts run: | - msbuild FastGithub.UI/FastGithub.UI.csproj /p:Configuration=Release /p:Platform="Any CPU" + dotnet publish FastGithub/FastGithub.csproj -c Release -o ./publish/${{ matrix.os }} - name: Upload artifacts uses: actions/upload-artifact@v4 with: - name: fastgithub-all-platforms - path: | - ./publish/ - FastGithub.UI/bin/Release/ + name: fastgithub-${{ matrix.os }} + path: ./publish/${{ matrix.os }} From 767b2ad3149239e273f8740c7aab3d25f96e8bad Mon Sep 17 00:00:00 2001 From: loecom <154944277+loecom@users.noreply.github.com> Date: Sun, 8 Jun 2025 13:21:04 +0800 Subject: [PATCH 04/24] =?UTF-8?q?=E8=BF=99=E6=A0=B7=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E5=90=8E=EF=BC=8CJSON=20=E5=8F=8D=E5=BA=8F=E5=88=97=E5=8C=96?= =?UTF-8?q?=E5=B0=B1=E8=83=BD=E6=AD=A3=E5=B8=B8=E5=B7=A5=E4=BD=9C=EF=BC=8C?= =?UTF-8?q?=E8=A7=A3=E5=86=B3=E6=BA=90=E7=94=9F=E6=88=90=E6=A8=A1=E5=BC=8F?= =?UTF-8?q?=E4=B8=8B=E7=9A=84=E5=85=BC=E5=AE=B9=E6=80=A7=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- FastGithub.FlowAnalyze/FlowStatistics.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/FastGithub.FlowAnalyze/FlowStatistics.cs b/FastGithub.FlowAnalyze/FlowStatistics.cs index cab0a16..50484c2 100644 --- a/FastGithub.FlowAnalyze/FlowStatistics.cs +++ b/FastGithub.FlowAnalyze/FlowStatistics.cs @@ -8,21 +8,21 @@ public record FlowStatistics /// /// 获取总读上行 /// - public long TotalRead { get; init; } + public long TotalRead { get; set; } /// /// 获取总下行 /// - public long TotalWrite { get; init; } + public long TotalWrite { get; set; } /// /// 获取读取速率 /// - public double ReadRate { get; init; } + public double ReadRate { get; set; } /// /// 获取写入速率 /// - public double WriteRate { get; init; } + public double WriteRate { get; set; } } } From 27d536707c043ae9927f463397af1c98ba583c18 Mon Sep 17 00:00:00 2001 From: loecom <154944277+loecom@users.noreply.github.com> Date: Sun, 8 Jun 2025 13:25:15 +0800 Subject: [PATCH 05/24] Update FastGithub.csproj --- FastGithub/FastGithub.csproj | 1 + 1 file changed, 1 insertion(+) diff --git a/FastGithub/FastGithub.csproj b/FastGithub/FastGithub.csproj index 57ea9e4..3f694c9 100644 --- a/FastGithub/FastGithub.csproj +++ b/FastGithub/FastGithub.csproj @@ -6,6 +6,7 @@ MIT app.manifest true + net8.0 From 1ba9a5396aa94867be4dc2d4778122b847b26486 Mon Sep 17 00:00:00 2001 From: loecom <154944277+loecom@users.noreply.github.com> Date: Sun, 8 Jun 2025 13:27:18 +0800 Subject: [PATCH 06/24] Update FastGithub.csproj --- FastGithub/FastGithub.csproj | 1 - 1 file changed, 1 deletion(-) diff --git a/FastGithub/FastGithub.csproj b/FastGithub/FastGithub.csproj index 3f694c9..57ea9e4 100644 --- a/FastGithub/FastGithub.csproj +++ b/FastGithub/FastGithub.csproj @@ -6,7 +6,6 @@ MIT app.manifest true - net8.0 From 296833e57f983dbed77592fce437042eb1327757 Mon Sep 17 00:00:00 2001 From: loecom <154944277+loecom@users.noreply.github.com> Date: Sun, 8 Jun 2025 13:32:50 +0800 Subject: [PATCH 07/24] Update build.yml --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d6ce1d5..04150f9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -22,7 +22,7 @@ jobs: run: dotnet restore FastGithub.sln - name: Build - run: dotnet build FastGithub.sln --no-restore --configuration Release + run: dotnet build FastGithub.sln --no-restore --configuration Release --verbosity quiet - name: Test run: dotnet test FastGithub.sln --no-build --configuration Release --verbosity normal From 8b45b2e305e242869d2a8e8cfde828877d831ae1 Mon Sep 17 00:00:00 2001 From: loecom <154944277+loecom@users.noreply.github.com> Date: Sun, 8 Jun 2025 13:34:36 +0800 Subject: [PATCH 08/24] Update build.yml --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 04150f9..3149547 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -44,7 +44,7 @@ jobs: - name: Build for ${{ matrix.os }} run: | dotnet restore FastGithub.sln - dotnet build FastGithub.sln --configuration Release + dotnet build FastGithub.sln --configuration Release --verbosity quiet - name: Publish artifacts run: | From e9e8831ce74387071f9e53cd6c1ea032afa87ee7 Mon Sep 17 00:00:00 2001 From: loecom <154944277+loecom@users.noreply.github.com> Date: Sun, 8 Jun 2025 14:42:43 +0800 Subject: [PATCH 09/24] Update build.yml --- .github/workflows/build.yml | 64 +++++++++++++++++-------------------- 1 file changed, 29 insertions(+), 35 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3149547..a95f7e8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,14 +1,17 @@ -name: Build FastGithub +name: Build and Release FastGithub on: push: - branches: [ main, master ] - pull_request: - branches: [ main, master ] + tags: + - 'v*' + workflow_dispatch: jobs: build: runs-on: ubuntu-latest + strategy: + matrix: + runtime: [win-x64, linux-x64, osx-x64] steps: - uses: actions/checkout@v4 @@ -19,39 +22,30 @@ jobs: dotnet-version: '7.0.x' - name: Restore dependencies - run: dotnet restore FastGithub.sln - - - name: Build - run: dotnet build FastGithub.sln --no-restore --configuration Release --verbosity quiet - - - name: Test - run: dotnet test FastGithub.sln --no-build --configuration Release --verbosity normal - - build-multi-platform: - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ubuntu-latest, windows-latest, macos-latest] - - steps: - - uses: actions/checkout@v4 - - - name: Setup .NET - uses: actions/setup-dotnet@v4 - with: - dotnet-version: '7.0.x' + run: dotnet restore - - name: Build for ${{ matrix.os }} + - name: Build and Publish run: | - dotnet restore FastGithub.sln - dotnet build FastGithub.sln --configuration Release --verbosity quiet - - - name: Publish artifacts + dotnet publish FastGithub/FastGithub.csproj \ + -c Release \ + -r ${{ matrix.runtime }} \ + --self-contained true \ + -p:PublishSingleFile=true \ + -p:PublishTrimmed=true \ + -o ./publish/${{ matrix.runtime }} + + - name: Create Archive run: | - dotnet publish FastGithub/FastGithub.csproj -c Release -o ./publish/${{ matrix.os }} - - - name: Upload artifacts + cd ./publish/${{ matrix.runtime }} + if [[ "${{ matrix.runtime }}" == "win-x64" ]]; then + zip -r ../../fastgithub-${{ matrix.runtime }}.zip . + else + tar -czf ../../fastgithub-${{ matrix.runtime }}.tar.gz . + fi + + - name: Upload Artifacts uses: actions/upload-artifact@v4 with: - name: fastgithub-${{ matrix.os }} - path: ./publish/${{ matrix.os }} + name: fastgithub-${{ matrix.runtime }} + path: | + fastgithub-${{ matrix.runtime }}.* From 55843f42480f759dedfd0967a75cbb5e656cf8c3 Mon Sep 17 00:00:00 2001 From: loecom <154944277+loecom@users.noreply.github.com> Date: Sun, 8 Jun 2025 14:43:55 +0800 Subject: [PATCH 10/24] Update build.yml --- .github/workflows/build.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a95f7e8..92a5d6d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,9 +2,9 @@ name: Build and Release FastGithub on: push: - tags: - - 'v*' - workflow_dispatch: + branches: [ main, master ] + pull_request: + branches: [ main, master ] jobs: build: From 90ca53a8e9a92a62afc33b389e0025145eac085a Mon Sep 17 00:00:00 2001 From: loecom <154944277+loecom@users.noreply.github.com> Date: Sun, 8 Jun 2025 14:47:29 +0800 Subject: [PATCH 11/24] Update build.yml --- .github/workflows/build.yml | 110 +++++++++++++++++++++--------------- 1 file changed, 66 insertions(+), 44 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 92a5d6d..e10f301 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,31 +1,63 @@ -name: Build and Release FastGithub - -on: - push: - branches: [ main, master ] - pull_request: - branches: [ main, master ] - -jobs: - build: - runs-on: ubuntu-latest - strategy: - matrix: - runtime: [win-x64, linux-x64, osx-x64] - - steps: - - uses: actions/checkout@v4 - - - name: Setup .NET - uses: actions/setup-dotnet@v4 - with: - dotnet-version: '7.0.x' - - - name: Restore dependencies - run: dotnet restore - - - name: Build and Publish - run: | +name: Build FastGithub + +on: + push: + branches: [ main, master, not-80-port ] + pull_request: + branches: [ main, master, not-80-port ] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: '7.0.x' + + - name: Restore dependencies + run: dotnet restore FastGithub.sln + + - name: Build + run: dotnet build FastGithub.sln --no-restore --configuration Release --verbosity quiet + + - name: Test + run: dotnet test FastGithub.sln --no-build --configuration Release --verbosity normal + + build-multi-platform: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + include: + - os: ubuntu-latest + runtime: linux-x64 + artifact-name: fastgithub-linux-x64 + - os: windows-latest + runtime: win-x64 + artifact-name: fastgithub-win-x64 + - os: macos-latest + runtime: osx-x64 + artifact-name: fastgithub-osx-x64 + + steps: + - uses: actions/checkout@v4 + + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: '7.0.x' + + - name: Build for ${{ matrix.os }} + run: | + dotnet restore FastGithub.sln + dotnet build FastGithub.sln --configuration Release --verbosity quiet + + - name: Publish single-file artifacts + run: | dotnet publish FastGithub/FastGithub.csproj \ -c Release \ -r ${{ matrix.runtime }} \ @@ -33,19 +65,9 @@ jobs: -p:PublishSingleFile=true \ -p:PublishTrimmed=true \ -o ./publish/${{ matrix.runtime }} - - - name: Create Archive - run: | - cd ./publish/${{ matrix.runtime }} - if [[ "${{ matrix.runtime }}" == "win-x64" ]]; then - zip -r ../../fastgithub-${{ matrix.runtime }}.zip . - else - tar -czf ../../fastgithub-${{ matrix.runtime }}.tar.gz . - fi - - - name: Upload Artifacts - uses: actions/upload-artifact@v4 - with: - name: fastgithub-${{ matrix.runtime }} - path: | - fastgithub-${{ matrix.runtime }}.* + + - name: Upload artifacts + uses: actions/upload-artifact@v4 + with: + name: ${{ matrix.artifact-name }} + path: ./publish/${{ matrix.runtime }} From 3bd45bf769fc4d007586119f20cbc852a948919d Mon Sep 17 00:00:00 2001 From: loecom <154944277+loecom@users.noreply.github.com> Date: Sun, 8 Jun 2025 14:50:36 +0800 Subject: [PATCH 12/24] Update build.yml --- .github/workflows/build.yml | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e10f301..b6a81bf 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -57,14 +57,7 @@ jobs: dotnet build FastGithub.sln --configuration Release --verbosity quiet - name: Publish single-file artifacts - run: | - dotnet publish FastGithub/FastGithub.csproj \ - -c Release \ - -r ${{ matrix.runtime }} \ - --self-contained true \ - -p:PublishSingleFile=true \ - -p:PublishTrimmed=true \ - -o ./publish/${{ matrix.runtime }} + run: dotnet publish FastGithub/FastGithub.csproj -c Release -r ${{ matrix.runtime }} --self-contained true -p:PublishSingleFile=true -p:PublishTrimmed=true -o ./publish/${{ matrix.runtime }} - name: Upload artifacts uses: actions/upload-artifact@v4 From 988361296eaca4e7288f3038448f4785ff02ce0b Mon Sep 17 00:00:00 2001 From: loecom <154944277+loecom@users.noreply.github.com> Date: Sun, 8 Jun 2025 15:02:36 +0800 Subject: [PATCH 13/24] Update build.yml --- .github/workflows/build.yml | 36 ++++++++++++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b6a81bf..e03e9b5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -55,10 +55,38 @@ jobs: run: | dotnet restore FastGithub.sln dotnet build FastGithub.sln --configuration Release --verbosity quiet - - - name: Publish single-file artifacts - run: dotnet publish FastGithub/FastGithub.csproj -c Release -r ${{ matrix.runtime }} --self-contained true -p:PublishSingleFile=true -p:PublishTrimmed=true -o ./publish/${{ matrix.runtime }} - + + - name: Publish single-file artifacts with UI + run: | + # 发布主程序 + dotnet publish FastGithub/FastGithub.csproj \ + -c Release \ + -r ${{ matrix.runtime }} \ + --self-contained true \ + -p:PublishSingleFile=true \ + -p:PublishTrimmed=true \ + -o ./publish/${{ matrix.runtime }} + + # 发布 UI (仅 Windows) + if [ "${{ matrix.runtime }}" == "win-x64" ]; then + dotnet publish FastGithub.UI/FastGithub.UI.csproj \ + -c Release \ + -r win-x64 \ + --self-contained true \ + -p:PublishSingleFile=true \ + -o ./publish/${{ matrix.runtime }} + fi + + - name: Copy additional files + run: | + # 复制必要的配置文件和资源 + cp README.md ./publish/${{ matrix.runtime }}/ + cp README.html ./publish/${{ matrix.runtime }}/ + cp LICENSE ./publish/${{ matrix.runtime }}/ + + # 创建证书目录(运行时需要) + mkdir -p ./publish/${{ matrix.runtime }}/cacert + - name: Upload artifacts uses: actions/upload-artifact@v4 with: From 4a569bc5c5ef79f77117a131134d7311856946b6 Mon Sep 17 00:00:00 2001 From: loecom <154944277+loecom@users.noreply.github.com> Date: Sun, 8 Jun 2025 15:08:30 +0800 Subject: [PATCH 14/24] Update build.yml --- .github/workflows/build.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e03e9b5..84cb514 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -53,8 +53,8 @@ jobs: - name: Build for ${{ matrix.os }} run: | - dotnet restore FastGithub.sln - dotnet build FastGithub.sln --configuration Release --verbosity quiet + dotnet restore FastGithub.sln --verbosity quiet --nologo + dotnet build FastGithub.sln --configuration Release --verbosity quiet --nologo - name: Publish single-file artifacts with UI run: | @@ -65,6 +65,8 @@ jobs: --self-contained true \ -p:PublishSingleFile=true \ -p:PublishTrimmed=true \ + --verbosity quiet \ + --nologo \ -o ./publish/${{ matrix.runtime }} # 发布 UI (仅 Windows) From 9e52ea9fa6aaecbdfb53212331adfb5e1ec81f0e Mon Sep 17 00:00:00 2001 From: loecom <154944277+loecom@users.noreply.github.com> Date: Sun, 8 Jun 2025 15:13:48 +0800 Subject: [PATCH 15/24] Update build.yml --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 84cb514..1ff0dfd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -57,6 +57,7 @@ jobs: dotnet build FastGithub.sln --configuration Release --verbosity quiet --nologo - name: Publish single-file artifacts with UI + shell: bash run: | # 发布主程序 dotnet publish FastGithub/FastGithub.csproj \ From 8436a32c2f28898112bf3b7b3aaf4718f85f1fb3 Mon Sep 17 00:00:00 2001 From: loecom <154944277+loecom@users.noreply.github.com> Date: Sun, 8 Jun 2025 15:19:16 +0800 Subject: [PATCH 16/24] Update build.yml --- .github/workflows/build.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1ff0dfd..1b90a4c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -74,9 +74,8 @@ jobs: if [ "${{ matrix.runtime }}" == "win-x64" ]; then dotnet publish FastGithub.UI/FastGithub.UI.csproj \ -c Release \ - -r win-x64 \ - --self-contained true \ - -p:PublishSingleFile=true \ + --verbosity quiet \ + --nologo \ -o ./publish/${{ matrix.runtime }} fi From 20f1736172ff2cf64e5ef6da40ac37dc4d4b157a Mon Sep 17 00:00:00 2001 From: loecom <154944277+loecom@users.noreply.github.com> Date: Sun, 8 Jun 2025 15:23:51 +0800 Subject: [PATCH 17/24] Update build.yml --- .github/workflows/build.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1b90a4c..6f37ae9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -58,6 +58,12 @@ jobs: - name: Publish single-file artifacts with UI shell: bash + env: + DOTNET_CLI_TELEMETRY_OPTOUT: 1 + DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 + DOTNET_NOLOGO: 1 + DOTNET_CLI_UI_LANGUAGE: en + DOTNET_SYSTEM_GLOBALIZATION_INVARIANT: 1 run: | # 发布主程序 dotnet publish FastGithub/FastGithub.csproj \ From b88eaec045226c14a6830692d110c1886fa3ad37 Mon Sep 17 00:00:00 2001 From: loecom <154944277+loecom@users.noreply.github.com> Date: Sun, 8 Jun 2025 15:26:57 +0800 Subject: [PATCH 18/24] Update build.yml --- .github/workflows/build.yml | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6f37ae9..ce2cb27 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,7 +16,10 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v4 with: - dotnet-version: '7.0.x' + dotnet-version: '7.0.x' + env: + DOTNET_NOLOGO: true + DOTNET_CLI_TELEMETRY_OPTOUT: true - name: Restore dependencies run: dotnet restore FastGithub.sln @@ -58,12 +61,10 @@ jobs: - name: Publish single-file artifacts with UI shell: bash - env: - DOTNET_CLI_TELEMETRY_OPTOUT: 1 - DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 - DOTNET_NOLOGO: 1 - DOTNET_CLI_UI_LANGUAGE: en - DOTNET_SYSTEM_GLOBALIZATION_INVARIANT: 1 + env: + DOTNET_NOLOGO: true + DOTNET_CLI_TELEMETRY_OPTOUT: true + DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true run: | # 发布主程序 dotnet publish FastGithub/FastGithub.csproj \ From 50cccc77353083bea0e1cecdb96b281b392cba90 Mon Sep 17 00:00:00 2001 From: loecom <154944277+loecom@users.noreply.github.com> Date: Sun, 8 Jun 2025 21:00:43 +0800 Subject: [PATCH 19/24] Update build.yml --- .github/workflows/build.yml | 141 +++++++++++++++--------------------- 1 file changed, 60 insertions(+), 81 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ce2cb27..e30229c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,70 +1,63 @@ -name: Build FastGithub - -on: - push: - branches: [ main, master, not-80-port ] - pull_request: - branches: [ main, master, not-80-port ] - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - - name: Setup .NET - uses: actions/setup-dotnet@v4 - with: +name: Build FastGithub + +on: + push: + branches: [ main, master, not-80-port ] + pull_request: + branches: [ main, master, not-80-port ] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: '7.0.x' + + - name: Restore dependencies + run: dotnet restore FastGithub.sln + + - name: Build + run: dotnet build FastGithub.sln --no-restore --configuration Release + + - name: Test + run: dotnet test FastGithub.sln --no-build --configuration Release --verbosity normal + + build-multi-platform: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + include: + - os: ubuntu-latest + runtime: linux-x64 + artifact-name: fastgithub-linux-x64 + - os: windows-latest + runtime: win-x64 + artifact-name: fastgithub-win-x64 + - os: macos-latest + runtime: osx-x64 + artifact-name: fastgithub-osx-x64 + + steps: + - uses: actions/checkout@v4 + + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: dotnet-version: '7.0.x' - env: - DOTNET_NOLOGO: true - DOTNET_CLI_TELEMETRY_OPTOUT: true - - - name: Restore dependencies - run: dotnet restore FastGithub.sln - - - name: Build - run: dotnet build FastGithub.sln --no-restore --configuration Release --verbosity quiet - - - name: Test - run: dotnet test FastGithub.sln --no-build --configuration Release --verbosity normal - - build-multi-platform: - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ubuntu-latest, windows-latest, macos-latest] - include: - - os: ubuntu-latest - runtime: linux-x64 - artifact-name: fastgithub-linux-x64 - - os: windows-latest - runtime: win-x64 - artifact-name: fastgithub-win-x64 - - os: macos-latest - runtime: osx-x64 - artifact-name: fastgithub-osx-x64 - - steps: - - uses: actions/checkout@v4 - - - name: Setup .NET - uses: actions/setup-dotnet@v4 - with: - dotnet-version: '7.0.x' - - - name: Build for ${{ matrix.os }} - run: | - dotnet restore FastGithub.sln --verbosity quiet --nologo - dotnet build FastGithub.sln --configuration Release --verbosity quiet --nologo + + - name: Build for ${{ matrix.os }} + run: | + dotnet restore FastGithub.sln + dotnet build FastGithub.sln --configuration Release - name: Publish single-file artifacts with UI shell: bash - env: - DOTNET_NOLOGO: true - DOTNET_CLI_TELEMETRY_OPTOUT: true - DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true run: | # 发布主程序 dotnet publish FastGithub/FastGithub.csproj \ @@ -73,31 +66,17 @@ jobs: --self-contained true \ -p:PublishSingleFile=true \ -p:PublishTrimmed=true \ - --verbosity quiet \ - --nologo \ -o ./publish/${{ matrix.runtime }} # 发布 UI (仅 Windows) if [ "${{ matrix.runtime }}" == "win-x64" ]; then dotnet publish FastGithub.UI/FastGithub.UI.csproj \ -c Release \ - --verbosity quiet \ - --nologo \ -o ./publish/${{ matrix.runtime }} fi - - name: Copy additional files - run: | - # 复制必要的配置文件和资源 - cp README.md ./publish/${{ matrix.runtime }}/ - cp README.html ./publish/${{ matrix.runtime }}/ - cp LICENSE ./publish/${{ matrix.runtime }}/ - - # 创建证书目录(运行时需要) - mkdir -p ./publish/${{ matrix.runtime }}/cacert - - - name: Upload artifacts - uses: actions/upload-artifact@v4 - with: - name: ${{ matrix.artifact-name }} + - name: Upload artifacts + uses: actions/upload-artifact@v4 + with: + name: ${{ matrix.artifact-name }} path: ./publish/${{ matrix.runtime }} From 59aa7f0361979ca109d01f0f721ebede7776495e Mon Sep 17 00:00:00 2001 From: loecom <154944277+loecom@users.noreply.github.com> Date: Sun, 8 Jun 2025 21:21:43 +0800 Subject: [PATCH 20/24] Update GlobalListener.cs --- FastGithub.Configuration/GlobalListener.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/FastGithub.Configuration/GlobalListener.cs b/FastGithub.Configuration/GlobalListener.cs index 9724f05..506563c 100644 --- a/FastGithub.Configuration/GlobalListener.cs +++ b/FastGithub.Configuration/GlobalListener.cs @@ -27,12 +27,12 @@ public static class GlobalListener /// /// http端口 /// - public static int HttpPort { get; } = OperatingSystem.IsWindows() ? GetAvailableTcpPort(80) : GetAvailableTcpPort(3880); + public static int HttpPort { get; } = OperatingSystem.IsWindows() ? GetAvailableTcpPort(3880) : GetAvailableTcpPort(3880); /// /// https端口 /// - public static int HttpsPort { get; } = OperatingSystem.IsWindows() ? GetAvailableTcpPort(443) : GetAvailableTcpPort(38443); + public static int HttpsPort { get; } = OperatingSystem.IsWindows() ? GetAvailableTcpPort(38443) : GetAvailableTcpPort(38443); /// /// 获取已监听的端口 From aa816bd81b08377cc016d7259c8e7d711b53a74a Mon Sep 17 00:00:00 2001 From: loecom <154944277+loecom@users.noreply.github.com> Date: Sun, 8 Jun 2025 21:25:30 +0800 Subject: [PATCH 21/24] Update build.yml --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e30229c..55b4e11 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,9 +2,9 @@ name: Build FastGithub on: push: - branches: [ main, master, not-80-port ] + branches: [ main, master ] pull_request: - branches: [ main, master, not-80-port ] + branches: [ main, master ] jobs: build: From 96399dffe838d7bd0fe7beb6774d85900abb8665 Mon Sep 17 00:00:00 2001 From: loecom <154944277+loecom@users.noreply.github.com> Date: Sun, 8 Jun 2025 21:42:04 +0800 Subject: [PATCH 22/24] Update GlobalListener.cs --- FastGithub.Configuration/GlobalListener.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/FastGithub.Configuration/GlobalListener.cs b/FastGithub.Configuration/GlobalListener.cs index 506563c..9724f05 100644 --- a/FastGithub.Configuration/GlobalListener.cs +++ b/FastGithub.Configuration/GlobalListener.cs @@ -27,12 +27,12 @@ public static class GlobalListener /// /// http端口 /// - public static int HttpPort { get; } = OperatingSystem.IsWindows() ? GetAvailableTcpPort(3880) : GetAvailableTcpPort(3880); + public static int HttpPort { get; } = OperatingSystem.IsWindows() ? GetAvailableTcpPort(80) : GetAvailableTcpPort(3880); /// /// https端口 /// - public static int HttpsPort { get; } = OperatingSystem.IsWindows() ? GetAvailableTcpPort(38443) : GetAvailableTcpPort(38443); + public static int HttpsPort { get; } = OperatingSystem.IsWindows() ? GetAvailableTcpPort(443) : GetAvailableTcpPort(38443); /// /// 获取已监听的端口 From 483e8cf0f3f6955c0afe6413c784324149709f9c Mon Sep 17 00:00:00 2001 From: loecom <154944277+loecom@users.noreply.github.com> Date: Sun, 8 Jun 2025 21:54:46 +0800 Subject: [PATCH 23/24] Create release.yml --- .github/workflows/release.yml | 185 ++++++++++++++++++++++++++++++++++ 1 file changed, 185 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..d8b205c --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,185 @@ +name: Create Release + +on: + workflow_dispatch: + inputs: + version: + description: '版本号 (例如: v1.0.0)' + required: true + type: string + prerelease: + description: '是否为预发布版本' + required: false + type: boolean + default: false + +jobs: + build-and-release: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: '7.0.x' + + - name: Validate version format + run: | + if [[ ! "${{ github.event.inputs.version }}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9]+)?$ ]]; then + echo "错误: 版本号格式不正确。请使用格式: v1.0.0 或 v1.0.0-beta" + exit 1 + fi + + - name: Check if tag exists + run: | + if git rev-parse "${{ github.event.inputs.version }}" >/dev/null 2>&1; then + echo "错误: 标签 ${{ github.event.inputs.version }} 已存在" + exit 1 + fi + + - name: Create and push tag + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git tag -a "${{ github.event.inputs.version }}" -m "Release ${{ github.event.inputs.version }}" + git push origin "${{ github.event.inputs.version }}" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + build-artifacts: + needs: build-and-release + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + include: + - os: ubuntu-latest + runtime: linux-x64 + artifact-name: fastgithub-linux-x64 + - os: windows-latest + runtime: win-x64 + artifact-name: fastgithub-win-x64 + - os: macos-latest + runtime: osx-x64 + artifact-name: fastgithub-osx-x64 + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + ref: ${{ github.event.inputs.version }} + + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: '7.0.x' + + - name: Restore dependencies + run: dotnet restore FastGithub.sln + + - name: Build and publish + shell: bash + run: | + # 发布主程序 + dotnet publish FastGithub/FastGithub.csproj \ + -c Release \ + -r ${{ matrix.runtime }} \ + --self-contained true \ + -p:PublishSingleFile=true \ + -p:PublishTrimmed=true \ + -o ./publish/${{ matrix.runtime }} + + # 发布 UI (仅 Windows) + if [ "${{ matrix.runtime }}" == "win-x64" ]; then + dotnet publish FastGithub.UI/FastGithub.UI.csproj \ + -c Release \ + -o ./publish/${{ matrix.runtime }} + fi + + - name: Create archive + shell: bash + run: | + cd ./publish/${{ matrix.runtime }} + if [ "${{ matrix.os }}" == "windows-latest" ]; then + 7z a -tzip ../../${{ matrix.artifact-name }}.zip * + else + tar -czf ../../${{ matrix.artifact-name }}.tar.gz * + fi + + - name: Upload artifacts + uses: actions/upload-artifact@v4 + with: + name: ${{ matrix.artifact-name }} + path: | + ${{ matrix.artifact-name }}.zip + ${{ matrix.artifact-name }}.tar.gz + + create-github-release: + needs: build-artifacts + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + ref: ${{ github.event.inputs.version }} + + - name: Download all artifacts + uses: actions/download-artifact@v4 + with: + path: ./artifacts + + - name: Prepare release assets + run: | + mkdir -p ./release-assets + find ./artifacts -name "*.zip" -o -name "*.tar.gz" | while read file; do + cp "$file" ./release-assets/ + done + ls -la ./release-assets/ + + - name: Generate release notes + id: release_notes + run: | + cat > release_notes.md << 'EOF' + ## FastGithub Release ${{ github.event.inputs.version }} + + 🚀 **新版本发布** + + ### 📦 下载说明 + - **Windows 用户**: 下载 `fastgithub-win-x64.zip` + - **Linux 用户**: 下载 `fastgithub-linux-x64.tar.gz` + - **macOS 用户**: 下载 `fastgithub-osx-x64.tar.gz` + + ### 🔧 安装说明 + 请参考 [README.md](https://github.com/${{ github.repository }}/blob/main/README.md) 中的部署方式。 + + ### ⚠️ 注意事项 + - Windows版本包含UI界面程序 + - 首次使用需要安装并信任CA证书 + - 详细配置请查看项目文档 + + --- + + **完整更新日志**: https://github.com/${{ github.repository }}/compare/$(git describe --tags --abbrev=0 HEAD^)...${{ github.event.inputs.version }} + EOF + + - name: Create GitHub Release + uses: softprops/action-gh-release@v1 + with: + tag_name: ${{ github.event.inputs.version }} + name: FastGithub ${{ github.event.inputs.version }} + body_path: release_notes.md + files: ./release-assets/* + draft: false + prerelease: ${{ github.event.inputs.prerelease }} + generate_release_notes: true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Cleanup artifacts + run: rm -rf ./artifacts ./release-assets release_notes.md From 87673891adac554f8a16dfaffab6e6ed21a8c47f Mon Sep 17 00:00:00 2001 From: loecom <154944277+loecom@users.noreply.github.com> Date: Sun, 8 Jun 2025 22:00:21 +0800 Subject: [PATCH 24/24] Update release.yml --- .github/workflows/release.yml | 42 +++++++++++++++++------------------ 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d8b205c..bf3c0a3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -80,27 +80,27 @@ jobs: dotnet-version: '7.0.x' - name: Restore dependencies - run: dotnet restore FastGithub.sln - - - name: Build and publish - shell: bash - run: | - # 发布主程序 - dotnet publish FastGithub/FastGithub.csproj \ - -c Release \ - -r ${{ matrix.runtime }} \ - --self-contained true \ - -p:PublishSingleFile=true \ - -p:PublishTrimmed=true \ - -o ./publish/${{ matrix.runtime }} - - # 发布 UI (仅 Windows) - if [ "${{ matrix.runtime }}" == "win-x64" ]; then - dotnet publish FastGithub.UI/FastGithub.UI.csproj \ - -c Release \ - -o ./publish/${{ matrix.runtime }} - fi - + run: dotnet restore FastGithub.sln + + - name: Build and publish + shell: bash + run: | + # 发布主程序 + dotnet publish FastGithub/FastGithub.csproj \ + -c Release \ + -r ${{ matrix.runtime }} \ + --self-contained true \ + -p:PublishSingleFile=true \ + -p:PublishTrimmed=true \ + -o ./publish/${{ matrix.runtime }} + + # 发布 UI (仅 Windows) + if [ "${{ matrix.runtime }}" == "win-x64" ]; then + dotnet publish FastGithub.UI/FastGithub.UI.csproj \ + -c Release \ + -o ./publish/${{ matrix.runtime }} + fi + - name: Create archive shell: bash run: |