Skip to content

Commit ea53da2

Browse files
committed
automatic build with creation of a draft release
1 parent e1fb092 commit ea53da2

1 file changed

Lines changed: 53 additions & 6 deletions

File tree

.github/workflows/auto-build.yml

Lines changed: 53 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,12 @@ on:
77
jobs:
88
build:
99
runs-on: windows-2022
10-
1110
env:
1211
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
13-
12+
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
1413
steps:
1514
- uses: actions/checkout@v5
16-
1715
- uses: nuget/setup-nuget@v2
18-
1916
- uses: microsoft/setup-msbuild@v2
2017
with:
2118
msbuild-architecture: x64
@@ -31,7 +28,16 @@ jobs:
3128
run: nuget restore OpenHardwareMonitor.sln
3229

3330
- name: Build
34-
run: msbuild OpenHardwareMonitor.sln -p:Configuration=Release -p:Platform="Any CPU" -m
31+
run: |
32+
msbuild OpenHardwareMonitor.sln /t:restore /p:RestorePackagesConfig=true /p:Configuration=Release /p:Platform="Any CPU"
33+
msbuild OpenHardwareMonitor.sln /t:Rebuild /p:Configuration=Release /p:Platform="Any CPU" -m
34+
msbuild OpenHardwareMonitor.sln /t:restore /p:RestorePackagesConfig=true /p:Configuration=Release /p:Platform="x64"
35+
msbuild OpenHardwareMonitor.sln /t:Rebuild /p:Configuration=Release /p:Platform="x64" -m
36+
msbuild OpenHardwareMonitor.sln /t:restore /p:RestorePackagesConfig=true /p:Configuration=Release /p:Platform="x86"
37+
msbuild OpenHardwareMonitor.sln /t:Rebuild /p:Configuration=Release /p:Platform="x86" -m
38+
39+
- name: Debug release files
40+
run: dir OpenHardwareMonitor/bin
3541

3642
- name: Publish build
3743
uses: actions/upload-artifact@v5
@@ -43,4 +49,45 @@ jobs:
4349
uses: actions/upload-artifact@v5
4450
with:
4551
name: OpenHardwareMonitorLib
46-
path: OpenHardwareMonitorLib/bin
52+
path: OpenHardwareMonitorLib/bin
53+
54+
- name: Create zip for each exe
55+
run: |
56+
$source = "OpenHardwareMonitor/bin"
57+
58+
Get-ChildItem -Path $source -Filter *.exe | ForEach-Object {
59+
$exePath = $_.FullName
60+
$zipPath = Join-Path $source ($_.BaseName + ".zip")
61+
62+
Compress-Archive -Path $exePath -DestinationPath $zipPath -Force
63+
}
64+
shell: powershell
65+
66+
- name: Debug release files with archives
67+
run: dir OpenHardwareMonitor/bin
68+
69+
- name: Get version from exe
70+
id: get_version
71+
run: |
72+
$file = Get-Item "OpenHardwareMonitor/bin/OpenHardwareMonitor.exe"
73+
$fullVersion = $file.VersionInfo.FileVersion
74+
75+
$parts = $fullVersion.Split('.')
76+
$shortVersion = "$($parts[0]).$($parts[1]).$($parts[2]).$($parts[3])"
77+
78+
echo "version=$shortVersion" >> $env:GITHUB_OUTPUT
79+
shell: powershell
80+
81+
- name: Debug version
82+
run: |
83+
echo "version is set: ${{ steps.get_version.outputs.version }}"
84+
85+
- name: Create Release
86+
uses: softprops/action-gh-release@v2
87+
with:
88+
tag_name: ${{ steps.get_version.outputs.version }}
89+
name: Build ${{ steps.get_version.outputs.version }}
90+
draft: true
91+
files: |
92+
OpenHardwareMonitor/bin/*.exe
93+
OpenHardwareMonitor/bin/*.zip

0 commit comments

Comments
 (0)