Version v1.0.12 #19
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: Build and Release | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| runs-on: windows-latest | |
| env: | |
| BUILD_OUT: "build_output" | |
| PACKAGE_DIR: "package_temp" | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Determine Version Tag | |
| id: get_tag | |
| shell: pwsh | |
| run: | | |
| $latestTag = git describe --tags $(git rev-list --tags --max-count=1) 2>$null | |
| if ($null -eq $latestTag) { $latestTag = "v1.0.0" } | |
| Write-Host "Latest detected tag: $latestTag" | |
| if ("${{ github.event_name }}" -eq "workflow_dispatch") { | |
| if ($latestTag -match '^v?(\d+)\.(\d+)\.(\d+)$') { | |
| $major = [int]$Matches[1] | |
| $minor = [int]$Matches[2] | |
| $patch = [int]$Matches[3] + 1 | |
| $newTag = "v$major.$minor.$patch" | |
| } else { | |
| $newTag = "v1.0.0" | |
| } | |
| } else { | |
| $newTag = "${{ github.ref_name }}" | |
| } | |
| Write-Host "Target Release Tag: $newTag" | |
| echo "NEW_TAG=$newTag" >> $env:GITHUB_ENV | |
| echo "version=$newTag" >> $env:GITHUB_OUTPUT | |
| - name: Setup MSBuild | |
| uses: microsoft/setup-msbuild@v2 | |
| - name: Setup NuGet | |
| uses: NuGet/setup-nuget@v1 | |
| - name: Restore NuGet packages | |
| run: nuget restore FurryArtStudio.sln | |
| - name: Build solution | |
| run: msbuild FurryArtStudio.sln /p:Configuration=Release /p:Platform="Any CPU" /p:OutputPath="${{ github.workspace }}\${{ env.BUILD_OUT }}" | |
| - name: Prepare files for packaging | |
| shell: pwsh | |
| run: | | |
| $src = "${{ github.workspace }}\${{ env.BUILD_OUT }}" | |
| $dest = "${{ github.workspace }}\${{ env.PACKAGE_DIR }}" | |
| if (Test-Path $dest) { Remove-Item -Recurse -Force $dest } | |
| New-Item -ItemType Directory -Force -Path $dest | |
| Copy-Item "$src\*.exe" $dest | |
| Copy-Item "$src\*.dll" $dest | |
| Copy-Item "$src\*.config" $dest -ErrorAction SilentlyContinue | |
| $subDirs = @("x64", "en-US", "zh-Hans", "zh-Hant") | |
| foreach ($dir in $subDirs) { | |
| if (Test-Path "$src\$dir") { Copy-Item -Recurse "$src\$dir" $dest } | |
| } | |
| Get-ChildItem -Path $dest -Include *.pdb, *.xml -Recurse | Remove-Item -Force | |
| - name: Create ZIP package | |
| shell: pwsh | |
| run: | | |
| $packageName = "FurryArtStudio-${{ env.NEW_TAG }}.zip" | |
| Compress-Archive -Path ".\${{ env.PACKAGE_DIR }}\*" -DestinationPath ".\$packageName" -Force | |
| - name: Create Release and Upload Assets | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ env.NEW_TAG }} | |
| name: Release ${{ env.NEW_TAG }} | |
| # generate_release_notes: true | |
| body_path: src/Docs/WHATSNEW.txt | |
| files: | | |
| ./FurryArtStudio-${{ env.NEW_TAG }}.zip | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |