Attempt to get rid of setting the version manually. #130
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: CI | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- '[0-9]+.[0-9]+.[0-9]+' | |
- '[0-9]+.[0-9]+.[0-9]+-[0-9a-zA-Z]+' | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Create NuGet Package (Branch) | |
if: github.ref_type != 'tag' | |
run: dotnet pack ./working --version-suffix "ci-${{ github.run_number }}" | |
- name: Create NuGet Package (Tag) | |
if: github.ref_type == 'tag' | |
run: dotnet pack ./working -p:PackageVersion=${{ github.ref_name }} | |
- name: Find created nuget | |
id: findcreatednuget | |
run: echo nugetPackageName=$(find . -type f -name '*.nupkg') >> $GITHUB_OUTPUT | |
shell: bash | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: NugetPackages | |
path: "${{ steps.findcreatednuget.outputs.nugetPackageName }}" | |
sign: | |
runs-on: windows-latest | |
needs: build | |
steps: | |
- name: Install Sign CLI tool | |
run: dotnet tool install sign -g --prerelease | |
- name: Download Unsigned NuGet | |
id: downloadUnsignedNuget | |
uses: actions/download-artifact@v4 | |
with: | |
name: NugetPackages | |
- name: Find Nuget | |
id: findcreatednuget | |
run: echo nugetPackageName=$(find . -type f -name '*.nupkg') >> $GITHUB_OUTPUT | |
shell: bash | |
- name: Sign NuGet Package | |
shell: pwsh | |
run: > | |
sign code azure-key-vault | |
${{ steps.findcreatednuget.outputs.nugetPackageName }} | |
--publisher-name "Skyline Communications" | |
--description "Skyline Signing" | |
--description-url "https://www.skyline.be/" | |
--azure-key-vault-tenant-id "5f175691-8d1c-4932-b7c8-ce990839ac40" | |
--azure-key-vault-client-id "a7ff072c-5bc8-4fa0-9e0c-bb9e40d59b0b" | |
--azure-key-vault-client-secret "${{ secrets.PFXPASSWORD }}" | |
--azure-key-vault-certificate "Skyline-CodeSigning" | |
--azure-key-vault-url "https://kv-slc-codesigning.vault.azure.net/" | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: SignedNugetPackages | |
path: "${{ steps.findcreatednuget.outputs.nugetPackageName }}" | |
push: | |
if: github.ref_type == 'tag' | |
name: push | |
runs-on: ubuntu-latest | |
needs: sign | |
steps: | |
- name: Download Signed NuGet | |
id: downloadSignedNuGet | |
uses: actions/download-artifact@v4 | |
with: | |
name: SignedNugetPackages | |
- name: Find Nuget | |
id: findcreatednuget | |
run: echo nugetPackageName=$(find . -type f -name '*.nupkg') >> $GITHUB_OUTPUT | |
shell: bash | |
- name: Push to NuGet.org | |
run: dotnet nuget push "${{ steps.findcreatednuget.outputs.nugetPackageName }}" --api-key ${{ secrets.NUGETAPIKEY }} --source https://api.nuget.org/v3/index.json | |
shell: bash |