fix: 改进更新服务网络兼容性,支持 TUN 模式直连与代理自动回退 #17
Workflow file for this run
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
| name: Release | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| permissions: | |
| contents: write | |
| jobs: | |
| build-and-release: | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup MSBuild | |
| uses: microsoft/setup-msbuild@v2 | |
| - name: Restore NuGet packages | |
| run: nuget restore LumiShift.sln | |
| - name: Build Release | |
| run: msbuild LumiShift.sln /p:Configuration=Release /p:Platform="Any CPU" /verbosity:minimal | |
| - name: List build artifacts | |
| shell: pwsh | |
| run: | | |
| Write-Host "=== Searching for build outputs ===" | |
| Get-ChildItem -Recurse -Filter "*.exe" LumiShift/bin/Release/ | ForEach-Object { Write-Host $_.FullName } | |
| Get-ChildItem -Recurse -Filter "*.config" LumiShift/bin/Release/ | ForEach-Object { Write-Host $_.FullName } | |
| - name: Copy exe to staging | |
| shell: pwsh | |
| run: | | |
| New-Item -ItemType Directory -Force -Path staging | |
| $exe = Get-ChildItem -Recurse -Filter "LumiShift.exe" LumiShift/bin/Release/ | Select-Object -First 1 | |
| if ($exe) { | |
| Copy-Item $exe.FullName staging/LumiShift.exe | |
| Write-Host "Copied: $($exe.FullName) -> staging/LumiShift.exe" | |
| } else { | |
| Write-Error "LumiShift.exe not found in build output!" | |
| exit 1 | |
| } | |
| - name: Extract version from tag | |
| id: version | |
| shell: bash | |
| run: | | |
| TAG="${GITHUB_REF#refs/tags/}" | |
| VERSION="${TAG#v}" | |
| echo "tag=$TAG" >> $GITHUB_OUTPUT | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| - name: Delete existing release (if any) | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| shell: bash | |
| run: | | |
| TAG="${GITHUB_REF#refs/tags/}" | |
| # Try to get release ID and delete it | |
| RELEASE=$(curl -s -H "Authorization: token $GITHUB_TOKEN" \ | |
| "https://api.github.com/repos/${GITHUB_REPOSITORY}/releases/tags/$TAG") | |
| RELEASE_ID=$(echo "$RELEASE" | jq -r '.id // empty') | |
| if [ -n "$RELEASE_ID" ] && [ "$RELEASE_ID" != "null" ]; then | |
| echo "Deleting existing release $RELEASE_ID for tag $TAG" | |
| curl -s -X DELETE -H "Authorization: token $GITHUB_TOKEN" \ | |
| "https://api.github.com/repos/${GITHUB_REPOSITORY}/releases/$RELEASE_ID" | |
| else | |
| echo "No existing release found for tag $TAG" | |
| fi | |
| - name: Extract changelog for release | |
| id: changelog | |
| shell: pwsh | |
| run: | | |
| $changelog = Get-Content -Raw CHANGELOG.md | |
| # Extract the content between "## [1.2.0]" and the next "## [" or "---" | |
| $pattern = "## \[1\.2\.0\][\s\S]*?(?=\n## \[|\n---)" | |
| $match = [regex]::Match($changelog, $pattern) | |
| if ($match.Success) { | |
| $body = $match.Value.Trim() | |
| # Set the body as a multi-line output | |
| $body | Set-Content -Path changelog_body.txt -Encoding UTF8 | |
| Write-Host "Extracted changelog for v1.2.0" | |
| } else { | |
| Write-Error "Changelog for v1.2.0 not found!" | |
| exit 1 | |
| } | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ steps.version.outputs.tag }} | |
| name: LumiShift ${{ steps.version.outputs.tag }} | |
| draft: false | |
| body_path: changelog_body.txt | |
| files: | | |
| staging/LumiShift.exe |