forked from BlueFinBima/Helios14
-
Notifications
You must be signed in to change notification settings - Fork 41
147 lines (127 loc) · 5.93 KB
/
Copy pathBuild.yml
File metadata and controls
147 lines (127 loc) · 5.93 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
name: 2. Build Release Candidate & Create MSI Files
# This workflow is intended to produce a new Helios build on a push on
# a release candidate branch. On successful build and packaging, the files
# are zipped and cached for use by the publishing workflow.
#
# This workflow requires strict adherence to the Helios Tag and Branch naming
# conventions.
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [ rc16* ]
pull_request:
branches: [ rc16* ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
build:
runs-on: windows-latest
if: ${{ contains(github.ref,'rc16') }}
steps:
- name: Checkout repository and submodules
uses: actions/checkout@v4
with:
submodules: recursive
fetch-tags: true
fetch-depth: 0
- name: New Version Number and Change the Version Project
run: |
$currentTag = $(git describe --tags --abbrev=0)
$currentBranch=$(git rev-parse --abbrev-ref HEAD)
# $latestTagForBranch=$(git tag -l --sort=-committerdate 1.6.$($currentBranch.substring(4))?.* | select -First 1)
$latestTagForBranch=$(git tag -l 1.6.$($currentBranch.substring(4))?.* | sort -V | select -Last 1)
echo "latest Tag: `"$latestTagForBranch`""
if ( -not ($latestTagForBranch -like "1.6.$($currentBranch.substring(4))?.*"))
{
git tag 1.6.$($currentBranch.substring(4))0.0
git push --tags origin
echo "BaseTag=1.6.$($currentBranch.substring(4))0.0" >> $env:GITHUB_ENV
$currentTag = "1.6.$($currentBranch.substring(4))0.0"
echo "Creating inital tag `"$currentTag`" for this branch."
}
else
{
echo "BaseTag=0" >> $env:GITHUB_ENV
echo "Current Branch: `"$currentBranch`""
echo "Current Tag: `"$currentTag`""
}
$newTag = $latestTagForBranch.substring(0,8) + "." + ([int]::parse($latestTagForBranch.substring(9).split('-')[0]) + 1)
echo "NewTag=$newTag" >> $env:GITHUB_ENV
echo "Current ref: `"${{github.ref}}`""
echo "The version of this installer will be `"$newTag`"."
echo "Success=false" >> $env:GITHUB_ENV
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v2
- name: Setup VS Dev Environment
uses: seanmiddleditch/gha-setup-vsdevenv@v5
- name: Navigate to Workspace
run: cd $GITHUB_WORKSPACE
- name: Disable Out of Process Building
run: .\DisableOutOfProcBuild.exe
working-directory: C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\IDE\CommonExtensions\Microsoft\VSI\DisableOutOfProcBuild
- uses: nuget/setup-nuget@v1
with:
nuget-api-key: ${{ secrets.NuGetAPIKey }}
nuget-version: '5.x'
- name: NuGet Restore
#if: steps.cache.outputs.cache-hit != 'true'
run: |
nuget restore BuildMeFirst.sln
nuget restore "KeyPressReceiver/Keypress Receiver.csproj"
nuget restore Thirdparty/StreamDeckSharp/src/StreamDeckSharp/StreamDeckSharp.csproj
nuget restore Thirdparty/OpenMacroBoard.SDK/src/OpenMacroBoard.SDK/OpenMacroBoard.SDK.csproj
nuget restore Thirdparty/OpenMacroBoard.SDK/src/OpenMacroBoard.VirtualBoard/OpenMacroBoard.VirtualBoard.csproj
nuget restore Helios.sln
- name: Clean and Build x86 and x64 Solutions
continue-on-error: true
shell: cmd
run: |
build.cmd %NewTag%
echo "rc=%errorlevel%" >> $env:GITHUB_ENV
- name: zip up build logs
continue-on-error: true
run: |
mkdir ./Assets
tar -a -c -f "BuildLogs.zip" -C "." *.binlog
- name: Upload Build Logs
uses: actions/upload-artifact@v4
with:
name: Build Logs
path: "./BuildLogs.zip"
retention-days: 2
- name: Force Error if there was a Previous Error
# This is a delayed exit because we needed to make the build logs available before leaving
if: ${{ env.rc != 0 }}
run: |
ForceExit # This should always cause an error because the program will not be found. The real error is going to be on the Clean & Build step above.
- name: zip up the msi
continue-on-error: true
run: |
tar -a -c -f "./Assets/Helios_Installers.zip" -C "Helios Installer\Release" *.msi -C "../../Keypress Receiver Installer/Release" *.msi -C "../../Tools Installer/Release" *.msi
tar -a -c -f "./Assets/Helios32Bit_Installers.zip" -C "Helios Installer/Release32" *.msi
tar -a -c -f "./Assets/Helios_StreamDeck_Alpha.zip" -C "bin/x64/Release" Plugins/OpenMacroBoard.SDK.dll Plugins/OpenMacroBoard.VirtualBoard.dll Plugins/StreamDeckSharp.dll Plugins/HeliosMacroBoard.dll
- uses: actions/cache@v3
id: cache
with:
path: ./Assets
key: Helios-installers-${{ env.NewTag }}
enableCrossOsArchive: true
- name: Upload Helios_Installers 1
uses: actions/upload-artifact@v4
with:
name: Helios ${{ env.NewTag }} Release Candidate 64Bit Installers
path: "./Assets/Helios_Installers.zip"
retention-days: 2
- name: Upload Helios_Installers 2
uses: actions/upload-artifact@v4
with:
name: Helios ${{ env.NewTag }} Release Candidate 32Bit Installers
path: "./Assets/Helios32Bit_Installers.zip"
retention-days: 2
- name: Upload Helios_Installers 3
uses: actions/upload-artifact@v4
with:
name: Helios ${{ env.NewTag }} Release Candidate Stream Deck Installer
path: "./Assets/Helios_StreamDeck_Alpha.zip"
retention-days: 2