-
Notifications
You must be signed in to change notification settings - Fork 0
111 lines (102 loc) · 3.22 KB
/
measurements-tool-nuget-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
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: measurements-tool-nuget-package
# https://docs.github.com/es/actions/deployment/about-deployments/deploying-with-github-actions#using-concurrency
concurrency:
group: production
cancel-in-progress: false
on:
push:
paths:
- '!docs/**'
branches:
- 'master'
# Allows you to run this workflow manually from the Actions tab on GitHub.
workflow_dispatch:
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v2
with:
dotnet-version: 7.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --configuration Release --no-restore
- name: Package
run: dotnet pack -c Release -o . MeasurementsTool.sln
# - name: Console Command list files
# run: |
# ls -R
- uses: actions/upload-artifact@v4
with:
name: solution-build
path: MeasurementsTool.*.nupkg
tests:
name: Run tests
runs-on: ubuntu-latest
needs: [build]
steps:
- uses: actions/checkout@v4
# - name: Test
# run: dotnet test MeasurementsTool.sln
- name: Test
run: dotnet test --collect:"XPlat Code Coverage" --results-directory:./CoverageResults/ MeasurementsTool.sln
- name: Move coverage result files
run: |
echo MOVER COVERAGE RESULTS
cp CoverageResults/*/*.xml CoverageResults/
- name: Codecov
uses: codecov/[email protected]
with:
name: Code coverage report
files: CoverageResults/coverage.cobertura.xml
flags: unittests
verbose: false
publish-github-package:
name: Publish GitHub package
runs-on: ubuntu-latest
needs: [build, tests]
steps:
- uses: actions/download-artifact@v4
with:
name: solution-build
path: .
- name: Add GitHub package source
run: dotnet nuget add source --username Sergi0Martin --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name MeasurementsTool "https://nuget.pkg.github.com/Sergi0Martin/index.json"
- name: Publish on GitHub Packages
run: dotnet nuget push MeasurementsTool.*.nupkg --api-key ${{ secrets.PUBLISHING_PACKAGES_PAT }} --source "MeasurementsTool"
publish-github-release:
name: Publish GitHub release
if: ${{ false }} # step disabled with false
runs-on: ubuntu-latest
needs: [build, tests]
steps:
- uses: actions/download-artifact@v4
with:
name: solution-build
path: .
- name: Create Release
# if: ${{ false }} # step disabled with false
uses: softprops/action-gh-release@v1
# if: startsWith(github.ref, 'refs/tags/')
with:
tag_name: release
files: |
*.nupkg
publish-nuget:
name: Publish nuget
runs-on: ubuntu-latest
environment:
name: production
url: https://www.nuget.org/packages/MeasurementsTool/
needs: [build, tests]
steps:
- uses: actions/download-artifact@v4
with:
name: solution-build
path: .
- name: Publish on nuget.org
run: dotnet nuget push *.nupkg --api-key ${{ secrets.PUBLISHING_PACKAGES_PAT }} --source https://api.nuget.org/v3/index.json