-
Notifications
You must be signed in to change notification settings - Fork 0
135 lines (111 loc) · 3.26 KB
/
cache-example.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
on:
workflow_dispatch:
name: Cache Example
permissions:
packages:
write
jobs:
cache-build:
name: Build - With Cache
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
6.0.x
7.0.x
8.0.x
- name: Restore dependencies
run: |
dotnet restore dekoeky.hello-world.tests
- name: Build
run: |
dotnet build dekoeky.hello-world.tests --no-restore -c Release
- uses: actions/cache@v2
id: restore-build
with:
path: dekoeky.hello-world.tests/bin/Release/*
key: ${{ github.sha }}
cache-use-build:
name: Re-use Cache
runs-on: ubuntu-latest
needs: [cache-build]
steps:
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
6.0.x
7.0.x
8.0.x
- uses: actions/cache@v2
id: restore-build
with:
path: dekoeky.hello-world.tests/bin/Release/*
key: ${{ github.sha }}
- run: tree
- run: |
dotnet test dekoeky.hello-world.tests/bin/Release/net6.0/dekoeky.hello-world.tests.dll --no-restore --no-build
dotnet test dekoeky.hello-world.tests/bin/Release/net7.0/dekoeky.hello-world.tests.dll --no-restore --no-build
dotnet test dekoeky.hello-world.tests/bin/Release/net8.0/dekoeky.hello-world.tests.dll --no-restore --no-build
artifact-build:
name: Build - With Artifact
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
6.0.x
7.0.x
8.0.x
- name: Restore dependencies
run: |
dotnet restore dekoeky.hello-world
- name: Build
run: |
dotnet build dekoeky.hello-world --no-restore -c Release
- name: Pack
run: |
dotnet pack dekoeky.hello-world --no-restore -c Release
- run: ls
- run: find . -type f \( -name *.nupkg -or -name *.snupkg \)
- uses: actions/upload-artifact@v2
with:
name: packages
path: |
dekoeky.hello-world/bin/Release/*.nupkg
dekoeky.hello-world/bin/Release/*.snupkg
upload-nuget-org:
name: Upload to NuGet.org
runs-on: ubuntu-latest
needs: [artifact-build]
steps:
- uses: actions/download-artifact@v2
with:
name: packages
- run: ls .
- run: tree .
- run: |
dotnet nuget push "*.nupkg" \
--skip-duplicate \
-s https://api.nuget.org/v3/index.json \
--api-key ${{ secrets.NUGET_API_KEY }}
upload-github:
name: Upload to GitHub
runs-on: ubuntu-latest
needs: [artifact-build]
steps:
- uses: actions/download-artifact@v2
with:
name: packages
- run: ls .
- run: tree .
- run: |
dotnet nuget push "*.nupkg" \
--skip-duplicate \
-s https://nuget.pkg.github.com/dekoeky/index.json \
--api-key ${{ secrets.GITHUB_TOKEN }}