-
Notifications
You must be signed in to change notification settings - Fork 29
62 lines (50 loc) · 1.97 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
name: Build
on:
workflow_call:
inputs:
packShipCandidate:
required: false
type: boolean
default: false
jobs:
build:
runs-on: ubuntu-latest
name: Build & Test
steps:
- uses: actions/checkout@v3
- name: Install .NET SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: 6.0.x
global-json-file: "./global.json"
- name: Restore dependencies
run: dotnet restore
- name: Create build number
run: |
now=$(date +'%Y%m%d')
buildNumber=$now.$GITHUB_RUN_NUMBER
echo "BUILD_NUMBER=$buildNumber" >> $GITHUB_ENV
echo "$buildNumber"
- name: Build
run: dotnet build --configuration Release --no-restore -p:BuildNumber=$BUILD_NUMBER -p:SourceRevisionId=$GITHUB_SHA -p:ContinuousIntegrationBuild=true
- name: Test
run: dotnet test --configuration Release --no-restore --no-build
- name: Publish samples
run: |
for projectPath in ./samples/**/*.csproj ; do
projectFileName=${projectPath##*/}
projectName=${projectFileName%.*}
dotnet publish "$projectPath" --output "./artifacts/$projectName" --configuration Release --no-build --verbosity normal
done;
./artifacts/Samples.Console/Samples.Console "MiniValidation"
- name: Pack (ci)
run: dotnet pack --configuration Release --output ./artifacts/ci --verbosity normal -p:BuildNumber=$BUILD_NUMBER -p:SourceRevisionId=$GITHUB_SHA -p:ContinuousIntegrationBuild=true
- name: Pack (ship candidate)
if: ${{ inputs.packShipCandidate }}
run: dotnet pack --configuration Release --output ./artifacts/ship --verbosity normal -p:BuildNumber=$BUILD_NUMBER -p:SourceRevisionId=$GITHUB_SHA -p:ContinuousIntegrationBuild=true -p:IsShipCandidate=true
- name: Upload artifacts (packages)
uses: actions/upload-artifact@v4
with:
name: nupkg
path: ./artifacts/**/*.nupkg
retention-days: 5