Skip to content

Commit 8bcdc8d

Browse files
committed
New dedicated building workflow
Moving the old debug build workflow into a new, portable and configurable building workflow. Currently nothing builds automatically, so more specific workflows need to be created. - Accepts buildMode and version parameters - Specify any build configuration already defined in msbuild - Use modern method of setting env vars https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-an-environment-variable - Output is in a predictable, runner-domain location
1 parent 1c73454 commit 8bcdc8d

File tree

2 files changed

+83
-56
lines changed

2 files changed

+83
-56
lines changed

.github/workflows/build-solution.yaml

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: build-solution
2+
3+
# defaults:
4+
# run:
5+
# working-directory: WinNUT_V2
6+
7+
on:
8+
workflow_dispatch:
9+
inputs:
10+
buildMode:
11+
description: 'Solution build mode passed to MSBuild.'
12+
required: true
13+
type: string
14+
15+
version:
16+
description: 'Version number to refer to this build and its assets, in `v.major.minor.build`.'
17+
required: true
18+
type: string
19+
workflow_call:
20+
inputs:
21+
buildMode:
22+
description: 'Solution build mode passed to MSBuild.'
23+
required: true
24+
type: string
25+
26+
version:
27+
description: 'Version number to refer to this build and its assets, in `v.major.minor.build`.'
28+
required: true
29+
type: string
30+
31+
# pull_request:
32+
# branches: [ main, Dev-2.2 ] # Build for dev primarily, probably don't need main...?
33+
# paths:
34+
# - '**.vb'
35+
# - '**.vbproj'
36+
37+
env:
38+
DOTNET_VERSION: '4.8'
39+
SLN_FILE: WinNUT_V2.sln
40+
SLN_DIR: WinNUT_V2
41+
42+
jobs:
43+
build:
44+
name: build-${{ matrix.os }}
45+
runs-on: ${{ matrix.os }}
46+
strategy:
47+
matrix:
48+
os: [windows-latest]
49+
outputs:
50+
asmVersion: ${{ steps.getversion.outputs.version }}
51+
steps:
52+
# Build output goes in this runner's temp directory
53+
- name: Get output directory
54+
run: echo "OUTPUT=${{ runner.temp }}\build-output" >> $env:GITHUB_ENV
55+
56+
# Make MSBuild available from $PATH.
57+
- name: setup-msbuild
58+
uses: microsoft/setup-msbuild@v1
59+
60+
- name: Checkout Code
61+
uses: actions/checkout@v3
62+
63+
- name: Restore Packages
64+
run: msbuild $env:SLN_DIR -t:restore
65+
66+
# msbuild cannot handle .vdproj Installer projects, so only build debug for now.
67+
- name: Build solution
68+
run: msbuild $env:SLN_DIR\$env:SLN_FILE -nologo -property:Configuration=${{ inputs.buildMode }} -property:OutDir=${{ env.OUTPUT }}
69+
70+
# For now, let msbuild continue autogenerating assembly versions and base everything off of that.
71+
- name: Get AssemblyVersion generated by msbuild
72+
id: getversion
73+
uses: berglie/assembly-version/get@v1
74+
with:
75+
directory: ${{ env.OUTPUT }}
76+
77+
- name: Upload Artifact
78+
uses: actions/upload-artifact@v3
79+
with:
80+
name: ${{ format('winnut-client-{0}-{1}', inputs.buildMode, vars.GITHUB_WORKFLOW_SHA) }}
81+
if-no-files-found: error
82+
path: ${{ env.OUTPUT }}
83+

.github/workflows/build-validate.yaml

Lines changed: 0 additions & 56 deletions
This file was deleted.

0 commit comments

Comments
 (0)