-
Notifications
You must be signed in to change notification settings - Fork 304
可以正常云编译和发布了 #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
可以正常云编译和发布了 #4
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
465e5e5
Create build.yml
loecom dcbd714
Update build.yml
loecom 4e30e44
Update build.yml
loecom 767b2ad
这样修改后,JSON 反序列化就能正常工作,解决源生成模式下的兼容性问题。
loecom 27d5367
Update FastGithub.csproj
loecom 1ba9a53
Update FastGithub.csproj
loecom 296833e
Update build.yml
loecom 8b45b2e
Update build.yml
loecom e9e8831
Update build.yml
loecom 55843f4
Update build.yml
loecom 90ca53a
Update build.yml
loecom 3bd45bf
Update build.yml
loecom 9883612
Update build.yml
loecom 4a569bc
Update build.yml
loecom 9e52ea9
Update build.yml
loecom 8436a32
Update build.yml
loecom 20f1736
Update build.yml
loecom b88eaec
Update build.yml
loecom 50cccc7
Update build.yml
loecom 59aa7f0
Update GlobalListener.cs
loecom aa816bd
Update build.yml
loecom 96399df
Update GlobalListener.cs
loecom f26fd60
Merge pull request #1 from loecom/可以正常编译正常使用。
loecom 483e8cf
Create release.yml
loecom 8767389
Update release.yml
loecom File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
82 changes: 82 additions & 0 deletions
.github/workflows/build.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| name: Build FastGithub | ||
|
|
||
| on: | ||
| push: | ||
| branches: [ main, master ] | ||
| pull_request: | ||
| branches: [ main, master ] | ||
|
|
||
| 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' | ||
|
|
||
| - 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 | ||
| 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: Upload artifacts | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: ${{ matrix.artifact-name }} | ||
| path: ./publish/${{ matrix.runtime }} |
185 changes: 185 additions & 0 deletions
.github/workflows/release.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.