Skip to content

Commit 1dddbd5

Browse files
committed
优化 CI
1 parent 1a12654 commit 1dddbd5

File tree

2 files changed

+13
-32
lines changed

2 files changed

+13
-32
lines changed

.github/workflows/dotnet-build.yml

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,12 @@ jobs:
88
runs-on: windows-latest
99

1010
steps:
11-
- uses: actions/checkout@v1
11+
- uses: actions/checkout@v5
1212
- name: Setup .NET
13-
uses: actions/setup-dotnet@v1
14-
with:
15-
dotnet-version: |
16-
8.0.x
17-
9.0.x
13+
uses: actions/setup-dotnet@v5
1814

1915
- name: Build
2016
run: dotnet build -c release
2117

22-
- name: Test Debug
23-
run: dotnet test -c debug
24-
25-
- name: Test Release
26-
run: dotnet test -c release
27-
2818
- name: Pack
2919
run: dotnet pack ./src/DotNetCampus.WeChatWork -c release --no-build
Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: NuGet Package
22

3-
on:
3+
on:
44
push:
55
tags:
66
- '*'
@@ -11,36 +11,27 @@ jobs:
1111
runs-on: windows-latest
1212

1313
steps:
14-
- uses: actions/checkout@v1
14+
- uses: actions/checkout@v5
1515

1616
- name: Setup .NET
17-
uses: actions/setup-dotnet@v1
18-
with:
19-
dotnet-version: |
20-
8.0.x
21-
9.0.x
17+
uses: actions/setup-dotnet@v5
2218

2319
- name: Install dotnet tool
2420
run: dotnet tool install -g dotnetCampus.TagToVersion
2521

26-
- name: Set tag to version
22+
- name: Set tag to version
2723
run: dotnet TagToVersion -t ${{ github.ref }}
2824

2925
- name: Build with dotnet
3026
run: |
3127
dotnet build -c release
3228
dotnet pack ./src/DotNetCampus.WeChatWork -c release --no-build
3329
34-
- name: Install Nuget
35-
uses: nuget/setup-nuget@v1
36-
with:
37-
nuget-version: '6.x'
38-
39-
- name: Add private GitHub registry to NuGet
40-
run: |
41-
nuget sources add -name github -Source https://nuget.pkg.github.com/dotnet-campus/index.json -Username dotnet-campus -Password ${{ secrets.GITHUB_TOKEN }}
42-
43-
- name: Push generated package to GitHub registry
30+
- name: Publish
4431
run: |
45-
nuget push .\artifacts\package\release\*.nupkg -Source github -SkipDuplicate
46-
nuget push .\artifacts\package\release\*.nupkg -Source https://api.nuget.org/v3/index.json -SkipDuplicate -ApiKey ${{ secrets.NugetKey }}
32+
dotnet nuget push ".\artifacts\package\release\*.nupkg" \
33+
--api-key ${{ secrets.GITHUB_TOKEN }} \
34+
--source https://nuget.pkg.github.com/${{ github.repository_owner }}
35+
dotnet nuget push ".\artifacts\package\release\*.nupkg" \
36+
--api-key ${{ secrets.NugetKey }} \
37+
--source https://api.nuget.org/v3/index.json

0 commit comments

Comments
 (0)