-
Notifications
You must be signed in to change notification settings - Fork 3
66 lines (59 loc) · 1.82 KB
/
dotnet.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
name: 'CI\CD'
on:
push:
branches: '*'
jobs:
build:
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.setOutputs.outputs.tag }}
steps:
- name: Checkout source
uses: actions/[email protected]
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/[email protected]
with:
dotnet-version: '8.0.x'
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore -c Release
- name: Test
run: dotnet test --no-build -c Release --verbosity normal
- name: Upload artifacts
uses: actions/[email protected]
with:
name: kli.Localize.v${{ env.GitBuildVersionSimple }}.nupkg
path: src/kli.Localize.Generator/bin/Release/*.nupkg
- name: Set job outputs
id: setOutputs
run: echo "tag=v${{ env.GitBuildVersionSimple }}" >> $GITHUB_OUTPUT
deploy:
runs-on: ubuntu-latest
needs: [build]
if: ${{ github.ref == 'refs/heads/main' }}
steps:
- name: Download artifacts
uses: actions/[email protected]
with:
name: kli.Localize.${{ needs.build.outputs.tag }}.nupkg
path: artifacts
- name: Generate changelog
id: changelog
uses: jaywcjlove/changelog-generator@main
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Create release
uses: ncipollo/release-action@v1
with:
artifacts: "artifacts/*.nupkg"
body: |
${{ steps.changelog.outputs.changelog }}
token: ${{ secrets.GITHUB_TOKEN }}
tag: "${{ needs.build.outputs.tag }}"
- name: Publish the package to nuget.org
run: dotnet nuget push artifacts/*.nupkg -k $NUGET_AUTH_TOKEN -s https://api.nuget.org/v3/index.json
env:
NUGET_AUTH_TOKEN: ${{ secrets.NUGET_TOKEN }}