Build and Release WPF Application #3
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 WPF Application | |
| on: | |
| release: | |
| types: [published] | |
| workflow_dispatch: | |
| jobs: | |
| build-and-release: | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: 9.0.x | |
| - name: Restore dependencies | |
| run: dotnet restore BananaLove/BananaLove.sln | |
| - name: Build application | |
| run: dotnet build BananaLove/BananaLove.sln --configuration Release --no-restore | |
| - name: Publish application | |
| run: dotnet publish BananaLove/BananaLove.csproj --configuration Release --output ./publish --self-contained true --runtime win-x64 | |
| - name: Create ZIP archive | |
| run: | | |
| cd publish | |
| Compress-Archive -Path * -DestinationPath ../BananaLove-${{ github.ref_name }}-win-x64.zip | |
| - name: Upload ZIP to Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: BananaLove-${{ github.ref_name }}-win-x64.zip | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Upload EXE to Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: publish/BananaLove.exe | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |