Publish v0.1.1 by @jrbentzon #12
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |