Skip to content

Commit 26f5cb8

Browse files
committed
ci: add github actions workflow for automatic releases
1 parent ed2894e commit 26f5cb8

1 file changed

Lines changed: 48 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Build and Release
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
tags:
7+
- 'v*'
8+
workflow_dispatch:
9+
10+
jobs:
11+
build:
12+
runs-on: windows-latest
13+
14+
steps:
15+
- uses: actions/checkout@v3
16+
17+
- name: Setup MSBuild
18+
uses: microsoft/setup-msbuild@v1.1
19+
20+
- name: Setup NuGet
21+
uses: NuGet/setup-nuget@v1
22+
23+
- name: Restore NuGet Packages
24+
run: nuget restore DisplayProfileManager.sln
25+
26+
- name: Build Solution
27+
run: msbuild DisplayProfileManager.sln /p:Configuration=Release /p:Platform="Any CPU"
28+
29+
- name: Prepare Release Bundle
30+
shell: pwsh
31+
run: |
32+
mkdir release
33+
copy bin/Release/*.exe release/
34+
copy bin/Release/*.dll release/
35+
copy bin/Release/*.config release/
36+
Compress-Archive -Path release/* -DestinationPath DisplayProfileManager.zip
37+
38+
- name: Create Release
39+
uses: softprops/action-gh-release@v1
40+
if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' || github.ref == 'refs/heads/main'
41+
with:
42+
tag_name: ${{ github.ref_name == 'main' && format('v1.0.{0}', github.run_number) || github.ref_name }}
43+
name: ${{ github.ref_name == 'main' && format('Release v1.0.{0}', github.run_number) || github.ref_name }}
44+
draft: false
45+
prerelease: false
46+
files: DisplayProfileManager.zip
47+
env:
48+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)