-
Notifications
You must be signed in to change notification settings - Fork 5
56 lines (48 loc) · 1.61 KB
/
packages.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
name: Kook.Net Packages
on:
workflow_call:
inputs:
dotnet-version:
description: '.NET version'
required: true
type: string
secrets:
NUGET_API_KEY:
description: 'NuGet API Key'
required: true
GITHUB_PACKAGES_KEY:
description: 'GitHub API Key'
required: true
jobs:
push_packages:
name: Push Packages
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ inputs.dotnet-version }}
- name: Cache Dependencies
uses: actions/cache@v4
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj', 'Kook.Net.targets') }}
restore-keys: |
${{ runner.os }}-nuget
- name: Generate Packages
run: dotnet pack --configuration Release --output packages
- name: Push Packages to NuGet
run: dotnet nuget push ./packages/*.nupkg -k ${{ env.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json --skip-duplicate
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
- name: Push Packages to Github
run: dotnet nuget push ./packages/*.nupkg -k ${{ env.GITHUB_PACKAGES_KEY }} -s https://nuget.pkg.github.com/gehongyan/index.json --skip-duplicate
env:
GITHUB_PACKAGES_KEY: ${{ secrets.GITHUB_PACKAGES_KEY }}
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: Packages
path: ./packages/