-
Notifications
You must be signed in to change notification settings - Fork 2
69 lines (58 loc) · 2.15 KB
/
release.yml
File metadata and controls
69 lines (58 loc) · 2.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
name: Build and Release NMEA2000 Analyzer
on:
push:
branches:
- main
workflow_dispatch:
jobs:
build:
name: Build
runs-on: windows-latest
permissions:
contents: write
steps:
# Checkout the repository
- name: Checkout code
uses: actions/checkout@v3
# Setup Visual Studio for .NET Framework or .NET Core/6.0+ projects
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v1
# Restore NuGet packages
- name: Restore dependencies
run: dotnet restore
# Build the solution
- name: Build Solution
run: |
msbuild NMEA2000Analyzer.sln /p:Configuration=Release /p:DebugType=None /p:GenerateSatelliteAssemblies=false
# Package the output into a ZIP file
- name: Create Release ZIP
run: |
mkdir artifacts
# Compress the build output into a ZIP file
powershell Compress-Archive -Path "bin\Release\net8.0-windows\*" -DestinationPath "artifacts\NMEA2000Analyzer.zip"
# Upload the ZIP file as an artifact for debugging or manual download
- name: Upload Build Artifact
uses: actions/upload-artifact@v4
with:
name: NMEA2000 Analyzer
path: artifacts/NMEA2000Analyzer.zip
- name: Extract AssemblyVersion
id: extract_version
run: |
[xml]$csproj = Get-Content ./NMEA2000Analyzer.csproj
$version = $csproj.Project.PropertyGroup.AssemblyVersion
if (-not $version) {
$version = $csproj.Project.PropertyGroup.Version
}
Write-Host "Extracted version: $version"
echo "version=$version" >> $env:GITHUB_ENV
- name: Get Short Commit SHA
id: vars
run: echo "::set-output name=short_sha::$(git rev-parse --short HEAD)"
- name: Upload Release Artifact to GitHub
uses: ncipollo/release-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag: v${{ env.version }}
name: NMEA2000 Analyzer v${{ env.version }}
artifacts: "artifacts/NMEA2000Analyzer.zip"