Skip to content

Commit c6d1fcd

Browse files
author
Monstroxx
committed
Add automated release workflow
1 parent a04eb54 commit c6d1fcd

1 file changed

Lines changed: 57 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Build and Release WPF Application
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*.*.*'
7+
workflow_dispatch:
8+
9+
jobs:
10+
build-and-release:
11+
runs-on: windows-latest
12+
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v4
16+
with:
17+
fetch-depth: 0
18+
19+
- name: Setup .NET
20+
uses: actions/setup-dotnet@v4
21+
with:
22+
dotnet-version: 9.0.x
23+
24+
- name: Restore dependencies
25+
run: dotnet restore BananaLove/BananaLove.sln
26+
27+
- name: Build application
28+
run: dotnet build BananaLove/BananaLove.sln --configuration Release --no-restore
29+
30+
- name: Publish application
31+
run: dotnet publish BananaLove/BananaLove.csproj --configuration Release --output ./publish --self-contained true --runtime win-x64
32+
33+
- name: Create ZIP archive
34+
run: |
35+
cd publish
36+
Compress-Archive -Path * -DestinationPath ../BananaLove-${{ github.ref_name }}-win-x64.zip
37+
38+
- name: Create Release
39+
uses: actions/create-release@v1
40+
id: create_release
41+
env:
42+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
43+
with:
44+
tag_name: ${{ github.ref_name }}
45+
release_name: BananaLove ${{ github.ref_name }}
46+
draft: false
47+
prerelease: false
48+
49+
- name: Upload Release Asset
50+
uses: actions/upload-release-asset@v1
51+
env:
52+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
53+
with:
54+
upload_url: ${{ steps.create_release.outputs.upload_url }}
55+
asset_path: ./BananaLove-${{ github.ref_name }}-win-x64.zip
56+
asset_name: BananaLove-${{ github.ref_name }}-win-x64.zip
57+
asset_content_type: application/zip

0 commit comments

Comments
 (0)