-
Notifications
You must be signed in to change notification settings - Fork 0
121 lines (100 loc) · 3.51 KB
/
build.yml
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
name: Build
on:
workflow_run:
workflows: [ "Changelog generator" ]
types:
- completed
workflow_dispatch:
jobs:
build:
name: Build
runs-on: windows-latest
env:
# Dotnet Setup
DOTNET_VERSION: 3.1.401
# Stop wasting time caching packages
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
# Disable sending usage data to Microsoft
DOTNET_CLI_TELEMETRY_OPTOUT: true
# Solution Setup
CONFIG: 'Release'
PROJECT_NAME: 'Cogworks.AzureSearch'
VERSION: '1.0.0'
SOURCE_PATH: './src'
# Nuget Setup
NUGET_VERSION: 'latest'
NUGET_OUTPUT: '.output/'
steps:
- name: Checkout reference commit
if: ${{ github.event_name == 'pull_request' }}
uses: actions/checkout@v2
- name: Checkout master
if: ${{ github.event_name != 'pull_request' }}
uses: actions/checkout@v2
with:
ref: master
fetch-depth: 0
- name: Get version
if: ${{ github.event_name != 'pull_request' }}
shell: bash
run: |
tag_check=$(git describe --exact-match `git rev-parse HEAD` | head -1)
echo "VERSION=$tag_check" >> $GITHUB_ENV
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v1
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Configure NuGet
uses: nuget/setup-nuget@v1
with:
nuget-version: ${{ env.NUGET_VERSION }}
- name: NuGet Restore
shell: powershell
working-directory: ${{ github.workspace }}
run: |
$solutions = Get-ChildItem -Path . -Recurse -Include *.sln
foreach ($solutionFile in $solutions){
nuget restore "$solutionFile"
}
- name: Install Dependencies
shell: powershell
working-directory: ${{ github.workspace }}
run: |
$solutions = Get-ChildItem -Path . -Recurse -Include *.sln
foreach ($solutionFile in $solutions){
dotnet restore "$solutionFile"
}
- name: Build
shell: powershell
working-directory: ${{ github.workspace }}
run: |
$solutions = Get-ChildItem -Path . -Recurse -Include *.sln
foreach ($solutionFile in $solutions){
msbuild.exe "$solutionFile" `
/p:Configuration=${{ env.CONFIG }} `
/p:DeployOnBuild=false `
/p:SkipInvalidConfigurations=true `
/p:TransformWebConfigEnabled=False `
/p:AutoParameterizationWebConfigConnectionStrings=False `
/p:MarkWebConfigAssistFilesAsExclude=False
}
- name: Pack all nuspec files
if: ${{ github.event_name != 'pull_request' }}
shell: powershell
working-directory: ${{ github.workspace }}
run: |
$nuspecFiles = Get-ChildItem -Path ${{ env.SOURCE_PATH}} -Recurse -Include *.nuspec
foreach ($nuspecFile in $nuspecFiles){
nuget pack "$nuspecFile" `
-Version ${{ env.VERSION }} `
-Properties "Configuration=${{ env.CONFIG }};CopyrightYear=$(Get-Date -Format yyyy)"`
-OutputDirectory ${{ env.NUGET_OUTPUT }}
}
- name: Upload build artifact
if: ${{ github.event_name != 'pull_request' }}
uses: actions/upload-artifact@v2
with:
name: build_${{ env.PROJECT_NAME }}.${{ env.VERSION }}
path: ${{ github.workspace }}/${{ env.NUGET_OUTPUT }}