-
Notifications
You must be signed in to change notification settings - Fork 0
76 lines (63 loc) · 2.71 KB
/
publish-public.yaml
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
name: Publish to Nuget.org package feed
run-name: Publish ${{github.ref_name}} by @${{ github.actor }}
on: workflow_dispatch
jobs:
release_to_nuget:
name: Release distribution to Github package feed
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/[email protected]
with:
dotnet-version: 6.0.x
- name: Set Package Version
run: |
set -e
version=$(git describe --tags --abbrev=7 | tr -d "v")
sed -i "s/<Version>0.0.0/<Version>$version/" src/SnD.ApiClient/SnD.ApiClient.csproj
sed -i "s/<Version>0.0.0/<Version>$version/" src/SnD.ApiClient.Azure/SnD.ApiClient.Azure.csproj
- name: Import Secrets
uses: hashicorp/[email protected]
with:
url: https://hashicorp-vault.production.sneaksanddata.com/
role: github
method: jwt
secrets: |
/secret/data/common/code_signing_certificates certificate_p12 | CERT ;
/secret/data/common/nuget_publish api_key | API_KEY ;
- name: Build NuGet for SnD.ApiClient
working-directory: ./src/SnD.ApiClient
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
set -euxo pipefail
version=$(git describe --tags --abbrev=7 | tr -d "v")
dotnet pack --configuration Release SnD.ApiClient.csproj
echo "$CERT" | base64 --decode > cert.p12
dotnet nuget sign "bin/Release/SnD.ApiClient.$version.nupkg" \
--certificate-path cert.p12 \
--timestamper http://timestamp.digicert.com
dotnet nuget push "bin/Release/SnD.ApiClient.$version.nupkg" --api-key "$API_KEY" \
--source https://api.nuget.org/v3/index.json
rm cert.p12
- name: Build NuGet for SnD.ApiClient.Azure
working-directory: ./src/SnD.ApiClient.Azure
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
set -euxo pipefail
version=$(git describe --tags --abbrev=7 | tr -d "v")
dotnet pack --configuration Release SnD.ApiClient.Azure.csproj
echo "$CERT" | base64 --decode > cert.p12
dotnet nuget sign "bin/Release/SnD.ApiClient.Azure.$version.nupkg" \
--certificate-path cert.p12 \
--timestamper http://timestamp.digicert.com
dotnet nuget push "bin/Release/SnD.ApiClient.Azure.$version.nupkg" --api-key "$API_KEY" \
--source https://api.nuget.org/v3/index.json
rm cert.p12