1
+ name : Publish Release
2
+ on :
3
+ push :
4
+ tags :
5
+ - " *"
6
+
7
+ permissions :
8
+ contents : read
9
+
10
+ concurrency : ${{ github.workflow }}-${{ github.ref }}
11
+
12
+ env :
13
+ DOTNET_SKIP_FIRST_TIME_EXPERIENCE : 1
14
+ DOTNET_NOLOGO : true
15
+ NuGetDirectory : ${{ github.workspace }}/nuget
16
+
17
+ jobs :
18
+ build :
19
+ runs-on : ubuntu-latest
20
+ steps :
21
+ - name : Tune GitHub-hosted runner network
22
+ uses : smorimoto/tune-github-hosted-runner-network@v1
23
+
24
+ - uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
25
+ with :
26
+ fetch-depth : 0 # Get all history for automatic versioning
27
+
28
+ - name : Setup dotnet
29
+ uses : actions/setup-dotnet@v5
30
+ with :
31
+ dotnet-version : " 8.0.x"
32
+
33
+ - name : Restore dependencies
34
+ run : dotnet restore
35
+
36
+ - name : Build
37
+ run : dotnet build --configuration Release --no-restore
38
+
39
+ - name : Test
40
+ run : dotnet test --no-restore --verbosity normal
41
+
42
+ - name : Pack
43
+ run : dotnet pack --configuration Release --output ${{ env.NuGetDirectory }} --no-build
44
+
45
+ - name : Upload artifacts
46
+ uses : actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
47
+ if : always()
48
+ with :
49
+ name : artifacts
50
+ path : ${{ env.NuGetDirectory }}
51
+
52
+ nuget-release :
53
+ name : Push to NuGet
54
+ needs : [build]
55
+ runs-on : ubuntu-latest
56
+ steps :
57
+ - name : Tune GitHub-hosted runner network
58
+ uses : smorimoto/tune-github-hosted-runner-network@v1
59
+
60
+ - name : Check out code
61
+ uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
62
+
63
+ - name : Download release binaries
64
+ uses : actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
65
+ with :
66
+ pattern : artifacts*
67
+ merge-multiple : true
68
+ path : ${{ env.NuGetDirectory }}
69
+
70
+ - name : Publish NuGet package
71
+ run : ./scripts/publish-nuget.sh "${{ env.NuGetDirectory }}" "${{ secrets.NUGET_API_KEY }}"
72
+
73
+ github-release :
74
+ name : Push Github Release
75
+ needs : [build]
76
+ runs-on : ubuntu-latest
77
+ permissions :
78
+ contents : write
79
+ steps :
80
+ - name : Tune GitHub-hosted runner network
81
+ uses : smorimoto/tune-github-hosted-runner-network@v1
82
+
83
+ - name : Check out code
84
+ uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
85
+
86
+ - name : Set TAG_NAME in Environment
87
+ # Subsequent steps will be have the computed tag name
88
+ run : echo "TAG_NAME=${GITHUB_REF##*/}" >> $GITHUB_ENV
89
+
90
+ - name : Download release binaries
91
+ uses : actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
92
+ with :
93
+ pattern : artifacts*
94
+ merge-multiple : true
95
+ path : ${{ env.NuGetDirectory }}
96
+
97
+ - name : Create or Update Release
98
+ env :
99
+ # Required for the GitHub CLI
100
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
101
+ run : ./scripts/github-release.sh --asset-dir=${{ env.NuGetDirectory }} --tag=${TAG_NAME}
0 commit comments