-
Notifications
You must be signed in to change notification settings - Fork 1
80 lines (68 loc) · 2.67 KB
/
release.yml
File metadata and controls
80 lines (68 loc) · 2.67 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
70
71
72
73
74
75
76
77
78
79
80
# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
name: .NET CI/CD
on:
push:
branches: [ "main" ]
jobs:
build-and-release:
runs-on: windows-latest
permissions:
contents: write
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup .NET SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: '9.0.x'
- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v1
with:
versionSpec: '5.x'
- name: Run GitVersion
id: gitversion
uses: gittools/actions/gitversion/execute@v1
- name: Restore dependencies
run: dotnet restore src/OTAPI.UnifiedServerProcess/OTAPI.UnifiedServerProcess.csproj
- name: Build project with version
run: >
dotnet build src/OTAPI.UnifiedServerProcess/OTAPI.UnifiedServerProcess.csproj
--configuration Release
/p:GitVersion_NuGetVersion=${{ steps.gitversion.outputs.nuGetVersionV2 }}
/p:GitVersion_AssemblySemVer=${{ steps.gitversion.outputs.assemblySemVer }}
/p:GitVersion_AssemblySemFileVer=${{ steps.gitversion.outputs.assemblySemFileVer }}
/p:GitVersion_InformationalVersion=${{ steps.gitversion.outputs.informationalVersion }}
- name: Run compiled EXE
run: |
cd src/OTAPI.UnifiedServerProcess/bin/Release/net9.0
.\OTAPI.UnifiedServerProcess.exe
- name: Create output zip file
run: |
$version = "${{ steps.gitversion.outputs.nuGetVersionV2 }}"
$outputDir = "src/OTAPI.UnifiedServerProcess/bin/Release/net9.0/output"
$zipPath = "UnifiedServerProcess-v$version.zip"
Compress-Archive -Path "$outputDir\*" -DestinationPath "$zipPath"
echo "Created zip at $zipPath"
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ steps.gitversion.outputs.nuGetVersionV2 }}
release_name: Release v${{ steps.gitversion.outputs.nuGetVersionV2 }}
draft: false
prerelease: false
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./UnifiedServerProcess-v${{ steps.gitversion.outputs.nuGetVersionV2 }}.zip
asset_name: UnifiedServerProcess-v${{ steps.gitversion.outputs.nuGetVersionV2 }}.zip
asset_content_type: application/zip