test #31
Workflow file for this run
This file contains 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*.*.*" | |
jobs: | |
build: | |
runs-on: windows-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Nuget | |
uses: NuGet/setup-nuget@v1.2.0 | |
- name: Restore nuget packages | |
run: nuget restore .\src\JiuLing.AutoUpgrade.sln | |
- name: Add msbuild to PATH | |
uses: microsoft/setup-msbuild@v1.1 | |
- name: Build core app | |
run: msbuild .\src\JiuLing.AutoUpgrade\JiuLing.AutoUpgrade.csproj /P:Configuration=Release | |
- name: Waiting for file copy | |
run: Start-Sleep -s 30 | |
shell: powershell | |
- name: Setup .NET 8 | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: 8.0.x | |
- name: Restore dependencies | |
run: dotnet restore .\src\JiuLing.AutoUpgrade.sln | |
- name: Build shell app | |
run: dotnet build .\src\JiuLing.AutoUpgrade.Shell\JiuLing.AutoUpgrade.Shell.csproj --no-restore -c release | |
- name: Get version | |
uses: olegtarasov/get-tag@v2.1 | |
id: tagName | |
- name: Create zip | |
shell: pwsh | |
# 配置【编译后的文件地址】 | |
run: Compress-Archive -Path ${{github.workspace}}\src\JiuLing.AutoUpgrade.Shell\bin\Release\* -DestinationPath ${{github.workspace}}\src\JiuLing.AutoUpgrade.Shell\bin\Release\JiuLing.AutoUpgrade.Shell_${{ steps.tagName.outputs.tag }}.zip | |
# 截取最新日志 | |
- name: Extract latest release notes | |
shell: pwsh | |
run: | | |
$changelog = Get-Content -Path "${{github.workspace}}\CHANGELOG.md" | |
$latestLog = $changelog -join "`n" -replace "(?s).*?(## \d+\.\d+\.\d+)",'$1' -replace "(?s)(## \d+\.\d+\.\d+).*",'$1' | |
Set-Content -Path "${{github.workspace}}\LATEST_CHANGELOG.md" -Value $latestLog | |
- name: Release | |
uses: softprops/action-gh-release@v2 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
# 配置【README地址】 | |
body_path: ${{github.workspace}}\LATEST_CHANGELOG.md | |
# 配置【zip文件地址】 | |
files: ${{github.workspace}}\src\JiuLing.AutoUpgrade.Shell\bin\Release\JiuLing.AutoUpgrade.Shell_${{ steps.tagName.outputs.tag }}.zip | |
#配置发布NuGet | |
- name: Publish | |
uses: brandedoutcast/publish-nuget@v2.5.5 | |
with: | |
PROJECT_FILE_PATH: src/JiuLing.AutoUpgrade.Shell/JiuLing.AutoUpgrade.Shell.csproj | |
PACKAGE_NAME: JiuLing.AutoUpgrade | |
NUGET_KEY: ${{secrets.NUGET_API_KEY}} | |
TAG_COMMIT: false |