Skip to content

Commit 62a4be4

Browse files
authored
Fixing signing & cleanup of workflow (SkylineCommunications#23)
1 parent eea9f20 commit 62a4be4

File tree

1 file changed

+22
-46
lines changed

1 file changed

+22
-46
lines changed

.github/workflows/CreateSignNuGet.yml

+22-46
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,41 @@
1-
# This is a basic workflow to help you get started with Actions
2-
31
name: CI
42

5-
# Controls when the workflow will run
63
on:
7-
# Triggers the workflow on push or pull request events but only for the master branch
84
push:
95
branches:
106
- main
11-
- master
127
tags:
138
- '[0-9]+.[0-9]+.[0-9]+'
149
- '[0-9]+.[0-9]+.[0-9]+-[0-9a-zA-Z]+'
1510

16-
# Allows you to run this workflow manually from the Actions tab
1711
workflow_dispatch:
1812

19-
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
2013
jobs:
21-
# Creates from a Nuspec file called template.nuspec located in the root of workspace"
2214
build:
23-
# The type of runner that the job will run on
2415
runs-on: ubuntu-latest
25-
# Steps represent a sequence of tasks that will be executed as part of the job
2616
steps:
2717
- uses: actions/checkout@v4
2818

2919
- name: Create NuGet Package
30-
run: |
31-
dotnet pack ./working
20+
run: dotnet pack ./working
3221

3322
- name: Find created nuget
3423
id: findcreatednuget
35-
run: |
36-
#cd ./working/bin/Debug/
37-
#echo nugetPackageName=$(dir *.nupkg) >> $GITHUB_OUTPUT
38-
echo nugetPackageName=$(find . -type f -name '*.nupkg') >> $GITHUB_OUTPUT
39-
shell: bash
40-
41-
- name: Echo Found Package
42-
id: echoFoundPackage
43-
run: echo "${{ steps.findcreatednuget.outputs.nugetPackageName }}"
24+
run: echo nugetPackageName=$(find . -type f -name '*.nupkg') >> $GITHUB_OUTPUT
4425
shell: bash
4526

4627
- uses: actions/upload-artifact@v4
4728
with:
4829
name: NugetPackages
4930
path: "${{ steps.findcreatednuget.outputs.nugetPackageName }}"
5031

51-
# Signing cannot be done from linux environment (https://github.com/dotnet/runtime/issues/48794)
5232
sign:
53-
# The type of runner that the job will run on
5433
runs-on: windows-latest
5534
needs: build
5635
steps:
36+
- name: Install Sign CLI tool
37+
run: dotnet tool install sign -g --prerelease
38+
5739
- name: Download Unsigned NuGet
5840
id: downloadUnsignedNuget
5941
uses: actions/download-artifact@v4
@@ -62,32 +44,28 @@ jobs:
6244

6345
- name: Find Nuget
6446
id: findcreatednuget
65-
run: |
66-
echo nugetPackageName=$(find . -type f -name '*.nupkg') >> $GITHUB_OUTPUT
67-
shell: bash
68-
69-
- name: Download Encrypted Signature File
70-
id: downloadSignatureFile
71-
env:
72-
CERTIFICATE_BASE64: ${{ secrets.SKYLINEPFX }}
73-
run: 'echo "$CERTIFICATE_BASE64" > encodedSignatureFile'
47+
run: echo nugetPackageName=$(find . -type f -name '*.nupkg') >> $GITHUB_OUTPUT
7448
shell: bash
7549

76-
- name: Decrypt Signature File
77-
id: decryptSignatureFile
78-
run: certutil -decode encodedSignatureFile Skyline.pfx
79-
shell: bash
80-
8150
- name: Sign NuGet Package
82-
run: |
83-
#nuget sign "${{ steps.findcreatednuget.outputs.nugetPackageName }}" -NonInteractive -CertificatePath "Skyline.pfx" -Timestamper "http://timestamp.comodoca.com/rfc3161" -CertificatePassword ${{ secrets.SKYLINEPFXPASSWORD }}
84-
dotnet nuget sign "${{ steps.findcreatednuget.outputs.nugetPackageName }}" --certificate-path "Skyline.pfx" --timestamper "http://timestamp.comodoca.com/rfc3161" --certificate-password ${{ secrets.SKYLINEPFXPASSWORD }}
85-
shell: bash
51+
shell: pwsh
52+
run: >
53+
sign code azure-key-vault
54+
${{ steps.findcreatednuget.outputs.nugetPackageName }}
55+
--publisher-name "Skyline Communications"
56+
--description "Skyline Signing"
57+
--description-url "https://www.skyline.be/"
58+
--azure-key-vault-tenant-id "5f175691-8d1c-4932-b7c8-ce990839ac40"
59+
--azure-key-vault-client-id "a7ff072c-5bc8-4fa0-9e0c-bb9e40d59b0b"
60+
--azure-key-vault-client-secret "${{ secrets.PFXPASSWORD }}"
61+
--azure-key-vault-certificate "Skyline-CodeSigning"
62+
--azure-key-vault-url "https://kv-slc-codesigning.vault.azure.net/"
8663
8764
- uses: actions/upload-artifact@v4
8865
with:
8966
name: SignedNugetPackages
9067
path: "${{ steps.findcreatednuget.outputs.nugetPackageName }}"
68+
9169
push:
9270
if: github.ref_type == 'tag'
9371
name: push
@@ -101,12 +79,10 @@ jobs:
10179
name: SignedNugetPackages
10280

10381
- name: Find Nuget
104-
id: findcreatednuget
105-
run: |
106-
echo nugetPackageName=$(find . -type f -name '*.nupkg') >> $GITHUB_OUTPUT
82+
id: findcreatednuget
83+
run: echo nugetPackageName=$(find . -type f -name '*.nupkg') >> $GITHUB_OUTPUT
10784
shell: bash
10885

10986
- name: Push to NuGet.org
110-
run: |
111-
dotnet nuget push "${{ steps.findcreatednuget.outputs.nugetPackageName }}" --api-key ${{ secrets.NUGETAPIKEY }} --source https://api.nuget.org/v3/index.json
87+
run: dotnet nuget push "${{ steps.findcreatednuget.outputs.nugetPackageName }}" --api-key ${{ secrets.NUGETAPIKEY }} --source https://api.nuget.org/v3/index.json
11288
shell: bash

0 commit comments

Comments
 (0)