generated from Stelzi79/DotNetTemplate
-
Notifications
You must be signed in to change notification settings - Fork 0
78 lines (78 loc) · 2.89 KB
/
ci.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
on:
push:
tags:
- "*"
branches:
- develop
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: benjlevesque/[email protected]
id: short-sha
with:
length: 7
- name: Setup dotnet
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.100-rc.1.22431.12
- name: run minver
id: version
uses: stelzi79/[email protected]
with:
auto-increment: minor
default-pre-release-phase: preview
verbosity: info
- name: output
run: |
echo ${{ steps.version.outputs.version }}
- name: Test
run: |
dotnet test --configuration Release --no-build
working-directory: ./src
env:
MinVerVersionOverride: ${{ steps.version.outputs.version }}
- name: Pack
run: |
dotnet restore
dotnet msbuild -t:Replace -t:MinVer
dotnet pack --configuration Release
working-directory: ./src
env:
MinVerVersionOverride: ${{ steps.version.outputs.version }}
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
.vs/bin/Stelzi79.NetSdk**/Release/**.nupkg
prerelease: false
env:
MinVerVersionOverride: ${{ steps.version.outputs.version }}
- name: PreRelease
uses: softprops/action-gh-release@v1
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
with:
name: NetSdk ${{ steps.version.outputs.version }}->${{ github.ref_name }} (Sha ${{ steps.short-sha.outputs.sha }}, Run ${{ github.run_number }}-${{ github.run_attempt }})
tag_name: Draft-${{ steps.version.outputs.version }}-${{ github.run_number }}_${{ github.run_attempt }}-${{ github.ref_type }}-${{ github.ref_name }}-${{ steps.short-sha.outputs.sha }}
body: |
${{ github.event.commits[0].message }}
${{ toJSON(github.event.commits) }}
${{ toJSON(steps.Pack.outputs) }}
files: |
.vs/bin/Stelzi79.NetSdk**/Release/**.nupkg
prerelease: true
- name: Publish the package to GPR
run: dotnet nuget push .vs/bin/**/Release/*.nupkg -k $NUGET_AUTH_TOKEN -s https://nuget.pkg.github.com/Stelzi79/index.json --skip-duplicate
env:
NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: Publish the package to nuget.org
run: dotnet nuget push .vs/bin/**/Release/*.nupkg -k $NUGET_AUTH_TOKEN -s https://api.nuget.org/v3/index.json --skip-duplicate
if: startsWith(github.ref, 'refs/tags/')
env:
NUGET_AUTH_TOKEN: ${{ secrets.NUGET_KEY }}