Skip to content

Commit 0176c12

Browse files
committed
Fix ci.yml
1 parent 17fce5a commit 0176c12

File tree

3 files changed

+31
-43
lines changed

3 files changed

+31
-43
lines changed

.github/workflows/ci.yml

+8-38
Original file line numberDiff line numberDiff line change
@@ -11,56 +11,26 @@ on:
1111
types: [published]
1212

1313
jobs:
14-
test:
14+
build:
1515
runs-on: ubuntu-latest
1616
name: Build
1717
steps:
18-
- name: Checkout
19-
uses: actions/checkout@v2
18+
- uses: actions/checkout@v4
2019
with:
2120
fetch-depth: 0
2221

23-
- uses: actions/cache@v2
22+
- uses: actions/setup-dotnet@v4
2423
with:
25-
path: ~/.nuget/packages
26-
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
27-
restore-keys: |
28-
${{ runner.os }}-nuget-
24+
dotnet-version: '8.x'
25+
cache: true
2926

30-
- name: Setup dotnet
31-
uses: actions/setup-dotnet@v1
32-
with:
33-
dotnet-version: '3.1'
34-
35-
- name: Setup dotnet
36-
uses: actions/setup-dotnet@v1
37-
with:
38-
dotnet-version: '5.0'
39-
40-
- name: Install GitVersion
41-
run: dotnet tool install -g GitVersion.Tool
42-
43-
- name: GitVersion
44-
run: dotnet gitversion /l console /output buildserver
45-
46-
- name: DotNet Build
47-
shell: pwsh
48-
run: |
49-
dotnet restore
50-
dotnet build --no-restore
51-
dotnet build --configuration Release --no-restore
52-
dotnet pack --configuration Release --no-restore --no-build
27+
- run: make build
5328

54-
- name: DotNet Test
55-
shell: pwsh
56-
run: |
57-
dotnet test --no-build --no-restore
29+
- run: make test
5830

5931
- name: Push NuGet
6032
if: |
6133
github.event.action == 'published'
62-
shell: pwsh
63-
run: dotnet nuget push **/*.nupkg --source $Env:SOURCE --api-key $Env:TOKEN
34+
run: make push-nuget
6435
env:
65-
SOURCE: 'https://api.nuget.org/v3/index.json'
6636
TOKEN: ${{ secrets.NUGET_API_KEY }}

.vscode/tasks.json

+10-5
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,21 @@
11
{
2-
"version": "0.1.0",
2+
"version": "2.0.0",
33
"command": "dotnet",
4-
"isShellCommand": true,
54
"args": [],
65
"tasks": [
76
{
8-
"taskName": "build",
7+
"label": "build",
8+
"type": "shell",
9+
"command": "dotnet",
910
"args": [
11+
"build",
1012
""
1113
],
12-
"isBuildCommand": true,
13-
"problemMatcher": "$msCompile"
14+
"problemMatcher": "$msCompile",
15+
"group": {
16+
"_id": "build",
17+
"isDefault": false
18+
}
1419
}
1520
]
1621
}

Makefile

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
.PHONY:
2+
3+
build:
4+
dotnet restore
5+
dotnet build --no-restore
6+
dotnet build --configuration Release --no-restore
7+
dotnet pack --configuration Release --no-restore --no-build
8+
9+
test:
10+
dotnet test --no-build --no-restore
11+
12+
push-nuget:
13+
dotnet nuget push **/*.nupkg --api-key $$TOKEN --source 'https://api.nuget.org/v3/index.json'

0 commit comments

Comments
 (0)