Skip to content

Package and publish nupkg #4

Package and publish nupkg

Package and publish nupkg #4

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
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
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
# Run the signing command
- name: Sign artifacts
shell: pwsh
run: >
./sign code azcodesign
**/*.nupkg
--base-directory "${{ github.workspace }}/BuildArtifacts"
-acsu "${{ secrets.AZURE_ENDPOINT }}"
-acsa "${{ secrets.AZURE_CODE_SIGNING_NAME }}"
-acscp "${{ secrets.AZURE_CERT_PROFILE_NAME }}"
-v "Debug"
--azcodesign-managed-identity
# Publish the signed packages
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: BuildArtifacts
path: SignedArtifacts