-
Notifications
You must be signed in to change notification settings - Fork 0
63 lines (54 loc) · 1.77 KB
/
ci-loopstats-function.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
name: Loopstats.LoopStats-CI
on:
workflow_dispatch:
pull_request:
paths:
- 'src/LoopStats/**'
branches:
- 'master'
- 'feature/**'
push:
paths:
- 'src/LoopStats/**'
branches:
- 'master'
env:
ARTIFACT_NAME: Loopstats.LoopStats-CI
CONFIGURATION: Release
DOTNET_VERSION: 6.0.x
PROJECT_DIRECTORY: ./src/LoopStats/
TEST_DIRECTORY: ./test/LoopStats.UnitTest/
PROJECT_NAME: LoopStats.csproj
jobs:
build:
name: Build, Test (& Pack) a .NET Project
runs-on: ubuntu-latest
defaults:
run:
working-directory: ${{ env.PROJECT_DIRECTORY }}
steps:
- uses: actions/checkout@master
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Restore .NET project
run: dotnet restore
- name: Build .NET project
run: dotnet build --no-restore --configuration ${{ env.CONFIGURATION }}
- name: Test .NET project
run: dotnet test
working-directory: ${{ env.TEST_DIRECTORY }}
- if: ${{ (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && github.ref == 'refs/heads/master' }}
name: Publish .NET project
run: |
dotnet publish --no-build --configuration ${{ env.CONFIGURATION }} --output ./publish
cd publish
zip -r ../${{ env.ARTIFACT_NAME }}.zip .
- if: ${{ (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && github.ref == 'refs/heads/master' }}
name: Publish Build Artifact
uses: actions/upload-artifact@v2
with:
name: ${{ env.ARTIFACT_NAME }}
path: ${{ env.PROJECT_DIRECTORY }}/${{ env.ARTIFACT_NAME }}.zip
if-no-files-found: error