-
Notifications
You must be signed in to change notification settings - Fork 0
93 lines (77 loc) · 2.46 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
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'
SOLUTION: 'Source\Cogworks.Essentials.sln'
PROJECT_NAME: 'Cogworks.Essentials'
VERSION: '1.0.0'
# 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 .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
run: nuget restore ${{ env.SOLUTION }}
- name: Install dependencies
run: dotnet restore ${{env.SOLUTION}}
- name: Build
run: |
dotnet build `
--configuration ${{ env.CONFIG }} `
${{ env.SOLUTION }}
- name: Pack all nuspec files
if: ${{ github.event_name != 'pull_request' }}
shell: bash
working-directory: ${{ github.workspace }}
run: |
for nuspecFile in ./Source/**/*.nuspec
do
nuget pack $nuspecFile \
-Version ${{ env.VERSION }} \
-Properties Configuration=${{ env.CONFIG }} \
-OutputDirectory ${{ env.NUGET_OUTPUT }}
done
- 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 }}