-
Notifications
You must be signed in to change notification settings - Fork 1
111 lines (94 loc) · 2.94 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
name: Build
on:
pull_request:
branches: [ main, master, develop ]
workflow_run:
workflows: [ "Changelog generator" ]
types:
- completed
workflow_dispatch:
jobs:
build:
name: Build
runs-on: ubuntu-20.04
env:
# 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: ${{ github.event.repository.name }}
VERSION: '1.0.0'
# Release Setup
NUGET_VERSION: 'latest'
NUGET_OUTPUT: '.nuget_output'
BINARIES_OUTPUT: '.binaries_output'
steps:
- name: Checkout reference commit
if: ${{ github.event_name == 'pull_request' }}
uses: actions/checkout@v4
- name: Checkout master
if: ${{ github.event_name != 'pull_request' }}
uses: actions/checkout@v4
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
- uses: actions/setup-node@v2
with:
node-version: '16.13.0'
- name: Setup .NET 6/7/8
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
6.0.x
7.0.x
8.0.x
- name: Configure NuGet
uses: nuget/setup-nuget@v1
with:
nuget-version: ${{ env.NUGET_VERSION }}
- name: Restore Dependencies
run: dotnet restore
- name: Build
run: |
dotnet build \
-c ${{ env.CONFIG }} \
--no-restore
- name: Publish
if: ${{ github.event_name != 'pull_request' }}
run: |
dotnet publish \
-o ${{ env.BINARIES_OUTPUT }} \
-c ${{ env.CONFIG }} \
-f net8.0 \
--no-build \
--no-restore
- name: Create NuGet package file
if: ${{ github.event_name != 'pull_request' }}
run: |
dotnet pack \
-c Release \
--include-symbols \
--no-restore \
-o ${{ env.NUGET_OUTPUT }} \
/p:Version=${{ env.VERSION }} \
/p:AssemblyVersion=${{ env.VERSION }}
- name: Upload NuGet artifact
if: ${{ github.event_name != 'pull_request' }}
uses: actions/upload-artifact@v2
with:
name: nuget_${{ env.PROJECT_NAME }}.${{ env.VERSION }}
path: ${{ github.workspace }}/${{ 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.BINARIES_OUTPUT }}/**/*