Skip to content

Commit d6e1b74

Browse files
author
Ahmad Noman Musleh
committed
Updated Nuget publish Github action
1 parent a691648 commit d6e1b74

4 files changed

Lines changed: 44 additions & 9 deletions

File tree

.github/workflows/publish_nuget_package_prereleased.yml

Lines changed: 35 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,45 @@ jobs:
88
build:
99
runs-on: ubuntu-latest
1010

11+
env:
12+
BUILD_CONFIG: 'Release'
13+
PROJECT: 'src/OpenAPI.Net/OpenAPI.Net.csproj'
14+
1115
steps:
1216
- uses: actions/checkout@v2
17+
18+
- name: Get Build Version
19+
run: |
20+
Import-Module .\build\GetBuildVersion.psm1
21+
Write-Host $Env:GITHUB_REF
22+
$version = GetBuildVersion -VersionString $Env:GITHUB_REF
23+
echo "BUILD_VERSION=$version" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
24+
shell: pwsh
25+
26+
- name: Setup NuGet
27+
uses: NuGet/setup-nuget@v1.0.5
28+
29+
- name: Restore dependencies
30+
run: nuget restore $PROJECT
31+
1332
- name: Setup .NET
1433
uses: actions/setup-dotnet@v1
1534
with:
1635
dotnet-version: '6.0.x'
17-
- name: Install dependencies
18-
run: dotnet restore src/OpenAPI.Net/OpenAPI.Net.csproj
36+
1937
- name: Build
20-
run: dotnet build src/OpenAPI.Net/OpenAPI.Net.csproj --configuration Release --no-restore
21-
- name: Publish on pre-release
22-
uses: rohith/publish-nuget@v2
23-
with:
24-
PROJECT_FILE_PATH: src/OpenAPI.Net/OpenAPI.Net.csproj
25-
NUGET_KEY: ${{secrets.NUGET_API_KEY}}
38+
run: dotnet build $PROJECT --configuration $BUILD_CONFIG --no-restore
39+
40+
- name: Decrypt Certificate
41+
run: ./decrypt_certificate.sh
42+
env:
43+
LARGE_SECRET_PASSPHRASE: ${{secrets.CERTIFICATE_GPG_PASSPHRASE}}
44+
45+
- name: Sign Package
46+
run: nuget sign **\*.nupkg -CertificatePath $HOME/secrets/certificate.pfx -Timestamper http://timestamp.digicert.com/
47+
48+
- name: Publish Package
49+
run: nuget push **\*.nupkg -Source 'https://api.nuget.org/v3/index.json' -ApiKey ${{secrets.NUGET_API_KEY}}
50+
51+
- name: Publish symbols
52+
run: nuget push **\*.snupkg -Source 'https://api.nuget.org/v3/index.json' -ApiKey ${{secrets.NUGET_API_KEY}}

certificate.pfx.gpg

7.02 KB
Binary file not shown.

decrypt_certificate.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/sh
2+
3+
# Decrypt the file
4+
mkdir $HOME/secrets
5+
# --batch to prevent interactive command
6+
# --yes to assume "yes" for questions
7+
gpg --quiet --batch --yes --decrypt --passphrase="$CERTIFICATE_GPG_PASSPHRASE" \
8+
--output $HOME/secrets/certificate.pfx certificate.pfx.gpg

src/OpenAPI.Net/OpenAPI.Net.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<PackageTags>cTrader, Open API, Spotware</PackageTags>
1010
<Description>A .NET RX library for Spotware Open API</Description>
1111
<PackageId>Spotware.OpenAPI.Net</PackageId>
12-
<Version>1.3.7-rc5</Version>
12+
<Version>1.3.7-rc6</Version>
1313
<Platforms>AnyCPU</Platforms>
1414
<Company>Spotware</Company>
1515
<Authors>Spotware</Authors>

0 commit comments

Comments
 (0)