-
Notifications
You must be signed in to change notification settings - Fork 1
98 lines (81 loc) · 2.36 KB
/
default.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
name: default
on:
push:
branches:
- develop
- main
pull_request:
branches:
- develop
- main
workflow_dispatch:
env:
DOTNET_NOLOGO: true
NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages
PLUGIN_SDK_CACHE: ${{ github.workspace }}/.plugins/cache
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
- name: setup dotnet
uses: actions/setup-dotnet@v4
with:
cache: true
cache-dependency-path: ./**/packages.lock.json
global-json-file: global.json
- name: cache plugins
uses: actions/cache@v3
with:
key: plugin-cache-${{ runner.os }}-${{ hashFiles('**/plugins.lock.json') }}
path: ${{ env.PLUGIN_SDK_CACHE }}
restore-keys: |
plugin-cache-${{ runner.os }}-
- name: restore
run: dotnet restore --locked-mode
- name: build
run: dotnet build --no-restore
pack:
needs: [build]
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- name: setup dotnet
uses: actions/setup-dotnet@v4
with:
cache: true
cache-dependency-path: ./**/packages.lock.json
global-json-file: global.json
- name: restore
run: dotnet restore src/LethalCompany.Plugin.Sdk.csproj --locked-mode
- name: pack
run: dotnet pack src/LethalCompany.Plugin.Sdk.csproj -c Release -o .sdk --no-restore
- name: upload artifact
uses: actions/upload-artifact@v4
with:
name: lc-plugin-sdk
path: .sdk
publish:
if: startsWith(github.ref, 'refs/heads/main') || startsWith(github.ref, 'refs/heads/develop')
needs: [pack]
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
with:
sparse-checkout: global.json
- name: setup dotnet
uses: actions/setup-dotnet@v4
with:
global-json-file: global.json
- name: download artifact
uses: actions/download-artifact@v4
with:
name: lc-plugin-sdk
- name: push
run: dotnet nuget push "*.nupkg" --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate