generated from yscorecore/RepoTemplate
-
Notifications
You must be signed in to change notification settings - Fork 0
54 lines (54 loc) · 2.23 KB
/
package.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
name: package
on:
push:
tags:
- "*"
jobs:
package:
runs-on: ubuntu-latest
steps:
- name: 01 Checkout Code
uses: actions/checkout@v1
- name: 02 Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.100
- name: 03 Set Dotnet Tools Path
run: echo "::set-env name=PATH::${PATH}:${HOME}/.dotnet/tools"
- name: 04 Check Code Format
run: dotnet tool install -g dotnet-format && dotnet format --dry-run --check
- name: 05 Build with dotnet
run: dotnet build
- name: 06 Count Test Projects
run: echo "::set-env name=TEST_PROJ_COUNT::$(ls -l test |grep "^d"|wc -l)"
- name: 07 Run Unit test
if: env.TEST_PROJ_COUNT>0
run: dotnet test /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura /p:Exclude="[*Test]*"
- name: 08 Combin All Test Report
if: env.TEST_PROJ_COUNT>0
run: dotnet tool install -g dotnet-reportgenerator-globaltool && reportgenerator -reports:test/*/coverage.cobertura.xml -reporttype:cobertura -targetdir:.
- name: 09 Save Artifact
if: env.TEST_PROJ_COUNT>0
uses: actions/upload-artifact@v1
with:
name: cobertura_report
path: ./Cobertura.xml
- name: 10 Upload coverage to Codecov
if: env.TEST_PROJ_COUNT>0
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: unittests
fail_ci_if_error: true
- name: 11 Set Git Tag Name
run: echo "::set-env name=GIT_TAG::${GITHUB_REF:10}"
- name: 12 Set Pack Version
run: echo "::set-env name=PACK_VERSION::${GIT_TAG#v}"
- name: 13 Create Package
run: dotnet pack -p:PackageVersion=${PACK_VERSION} -p:RepositoryUrl=${{github.event.repository.url}} -p:PackageProjectUrl=${{github.event.repository.url}} -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg -o .publish --configuration Release
- name: 14 Push Package
run: bash ./.github/scripts/pushpack.sh .publish ${{secrets.NUGET_APIKEY}}
- name: 15 Set Image Tag
run: echo "::set-env name=IMAGE_VERSION::${GIT_TAG#v}"
- name: 16 Build and Push Image Tag
run: bash ./.github/scripts/pushdocker.sh ${{secrets.DOCKER_USERNAME}} ${{secrets.DOCKER_PASSWORD}}