v0.2.2.2 サーバ共通設定関係の小修正 #14
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: | |
| jobs: | |
| build: | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup MSBuild | |
| uses: microsoft/setup-msbuild@v2 | |
| - name: Setup NuGet | |
| uses: nuget/setup-nuget@v2 | |
| - name: Restore NuGet packages | |
| run: nuget restore GhostDist.sln | |
| - name: Build Release | |
| run: msbuild GhostDist.sln /p:Configuration=Release /p:Platform="Any CPU" /p:OutputPath=bin\Release\ | |
| - name: Prepare release files | |
| run: | | |
| mkdir release | |
| copy GhostDist\bin\Release\GhostDist.exe release\ | |
| copy readme_for_deploy.txt release\readme.txt | |
| shell: cmd | |
| - name: Create ZIP archive | |
| run: | | |
| cd release | |
| Compress-Archive -Path GhostDist.exe,readme.txt -DestinationPath ghostdist.zip | |
| shell: powershell | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ghostdist | |
| path: release/ghostdist.zip | |
| - name: Generate release notes from commit log | |
| if: startsWith(github.ref, 'refs/tags/') | |
| id: release_notes | |
| run: | | |
| # Get current tag | |
| $currentTag = "${{ github.ref_name }}" | |
| # Get previous tag | |
| git fetch --tags | |
| $previousTag = git tag --sort=-version:refname | Select-Object -Skip 1 -First 1 | |
| if ($previousTag) { | |
| # Get commit log between previous tag and current tag | |
| $commitLog = git log --pretty=format:"- %s (%h)" "$previousTag..$currentTag" | |
| $releaseNotes = "## Changes from $previousTag to $currentTag`n`n$commitLog" | |
| } else { | |
| # If no previous tag exists, get all commits | |
| $commitLog = git log --pretty=format:"- %s (%h)" "$currentTag" | |
| $releaseNotes = "## Changes in $currentTag`n`n$commitLog" | |
| } | |
| # Save to file | |
| $releaseNotes | Out-File -FilePath release_notes.txt -Encoding UTF8 | |
| # Output for GitHub Actions | |
| "RELEASE_NOTES<<EOF" | Out-File -FilePath $env:GITHUB_OUTPUT -Append | |
| $releaseNotes | Out-File -FilePath $env:GITHUB_OUTPUT -Append | |
| "EOF" | Out-File -FilePath $env:GITHUB_OUTPUT -Append | |
| shell: powershell | |
| - name: Create Release | |
| if: startsWith(github.ref, 'refs/tags/') | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: release/ghostdist.zip | |
| draft: false | |
| prerelease: false | |
| body: ${{ steps.release_notes.outputs.RELEASE_NOTES }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |