-
Notifications
You must be signed in to change notification settings - Fork 1
59 lines (51 loc) · 1.64 KB
/
dotnet-publish.yml
File metadata and controls
59 lines (51 loc) · 1.64 KB
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
name: Publish .NET SDK to NuGet
on:
workflow_dispatch:
inputs:
version:
description: 'Package version (e.g. 0.2.0)'
required: true
type: string
permissions:
contents: read
jobs:
publish:
if: github.repository == 'grafana/sigil-sdk' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- name: Get secrets from Vault
id: get-secrets
uses: grafana/shared-workflows/actions/get-vault-secrets@f1614b210386ac420af6807a997ac7f6d96e477a # get-vault-secrets/v1.3.1
env:
VAULT_INSTANCE: ops
with:
vault_instance: ${{ env.VAULT_INSTANCE }}
common_secrets: |
NUGET_API_KEY=sigil-nuget:api-key
export_env: false
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9 # v4.3.1
with:
dotnet-version: '8.0.x'
- name: Pack
env:
PKG_VERSION: ${{ inputs.version }}
run: |
dotnet pack dotnet/Sigil.DotNet.sln -c Release \
-p:PackageVersion="${PKG_VERSION}" \
-o nupkgs/
- name: Publish
env:
NUGET_API_KEY: ${{ fromJSON(steps.get-secrets.outputs.secrets).NUGET_API_KEY }}
run: |
for pkg in nupkgs/*.nupkg; do
dotnet nuget push "$pkg" \
--api-key "${NUGET_API_KEY}" \
--source https://api.nuget.org/v3/index.json \
--skip-duplicate
done