Skip to content

Package and publish nupkg #16

Package and publish nupkg

Package and publish nupkg #16

Workflow file for this run

name: Package and publish nupkg
on:
workflow_dispatch:
jobs:
build:
name: Build app, sign files with Trusted Signing and deploy to NuGet
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v1
- name: Restore NuGet packages
run: cd src && nuget restore && cd ..
- name: Build
run: msbuild .\src\Org.Openfeed.Client\Org.Openfeed.Client.csproj /t:Pack /p:Configuration=Release /p:PackageOutputPath=..\..\publish
- name: List files in publish directory
run: dir .\publish
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: BuildArtifacts
path: ./publish/*.nupkg
sign:
needs: build
runs-on: windows-latest
permissions:
id-token: write # Required for requesting the JWT
steps:
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: BuildArtifacts
path: BuildArtifacts
# .NET is required on the agent for the tool to run
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: "9.x"
# Install the code signing tool
- name: Install Sign CLI tool
run: dotnet tool install --tool-path . --prerelease sign
# Login to Azure using a ServicePrincipal configured to authenticate agaist a GitHub Action
- name: "Az CLI login"
uses: azure/login@v1
with:
allow-no-subscriptions: true
creds: ${{ secrets.AZURE_CREDS }}
# Run the signing command
- name: Sign artifacts
uses: azure/powershell@v1
with:
azPSVersion: "latest"
inlineScript: |
./sign code trusted-signing *.nupkg -tse ${{ secrets.AZURE_ENDPOINT }} -tsa ${{secrets.AZURE_CODE_SIGNING_NAME}} -tscp ${{secrets.AZURE_CERT_PROFILE_NAME}} --base-directory "${{ github.workspace }}/BuildArtifacts"
# Publish the signed packages
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: BuildArtifacts
path: SignedArtifacts