Skip to content

Commit 6e6770b

Browse files
committed
Cherry pick
1 parent 38ca0b2 commit 6e6770b

File tree

1 file changed

+22
-44
lines changed

1 file changed

+22
-44
lines changed

.github/workflows/CreateSignNuGet.yml

+22-44
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,42 @@
1-
# This is a basic workflow to help you get started with Actions
21

32
name: CI
43

5-
# Controls when the workflow will run
64
on:
7-
# Triggers the workflow on push or pull request events but only for the master branch
85
push:
96
branches:
107
- internalMain
118
tags:
129
- '[0-9]+.[0-9]+.[0-9]+'
1310
- '[0-9]+.[0-9]+.[0-9]+-[0-9a-zA-Z]+'
1411

15-
# Allows you to run this workflow manually from the Actions tab
1612
workflow_dispatch:
1713

18-
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
1914
jobs:
20-
# Creates from a Nuspec file called template.nuspec located in the root of workspace"
2115
build:
22-
# The type of runner that the job will run on
2316
runs-on: ubuntu-latest
24-
# Steps represent a sequence of tasks that will be executed as part of the job
2517
steps:
2618
- uses: actions/checkout@v4
2719

2820
- name: Create NuGet Package
29-
run: |
30-
dotnet pack ./working
21+
run: dotnet pack ./working
3122

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

4528
- uses: actions/upload-artifact@v4
4629
with:
4730
name: NugetPackages
4831
path: "${{ steps.findcreatednuget.outputs.nugetPackageName }}"
4932

50-
# Signing cannot be done from linux environment (https://github.com/dotnet/runtime/issues/48794)
5133
sign:
52-
# The type of runner that the job will run on
5334
runs-on: windows-latest
5435
needs: build
5536
steps:
37+
- name: Install Sign CLI tool
38+
run: dotnet tool install sign -g --prerelease
39+
5640
- name: Download Unsigned NuGet
5741
id: downloadUnsignedNuget
5842
uses: actions/download-artifact@v4
@@ -61,32 +45,28 @@ jobs:
6145

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

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

10282
- name: Find Nuget
103-
id: findcreatednuget
104-
run: |
105-
echo nugetPackageName=$(find . -type f -name '*.nupkg') >> $GITHUB_OUTPUT
83+
id: findcreatednuget
84+
run: echo nugetPackageName=$(find . -type f -name '*.nupkg') >> $GITHUB_OUTPUT
10685
shell: bash
10786

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

0 commit comments

Comments
 (0)