Skip to content

Commit e48b302

Browse files
committed
feat(workflows): integrate NuGet signing into reusable sign-artifacts workflow
- Add NuGet package signing with SSL.com certificates - Support multiple signing types (gpg, nuget, both) - Add configurable input parameters for nuget signing options - Maintain backward compatibility with existing GPG signing - Updated documentation with comprehensive usage examples
1 parent c33cd29 commit e48b302

File tree

5 files changed

+177
-218
lines changed

5 files changed

+177
-218
lines changed

.github/workflows/reusable_sign-artifacts.yaml

Lines changed: 75 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
workflow_call:
55
inputs:
66
artifact-glob:
7-
description: Glob pattern to match artifacts to sign (e.g. dist/**/*.{jar,deb,rpm})
7+
description: Glob pattern to match artifacts to sign (e.g. dist/**/*.{jar,deb,rpm,nupkg})
88
required: true
99
type: string
1010
output-dir:
@@ -17,16 +17,45 @@ on:
1717
required: false
1818
type: number
1919
default: 7
20+
enable-nuget-signing:
21+
description: Enable SSL.com signing for NuGet packages
22+
required: false
23+
type: boolean
24+
default: false
25+
nuget-environment:
26+
description: SSL.com environment name for NuGet signing
27+
required: false
28+
type: string
29+
default: PROD
30+
jvm-max-memory:
31+
description: Maximum JVM memory for NuGet signing process
32+
required: false
33+
type: string
34+
default: 1024M
2035
secrets:
2136
gpg-private-key:
2237
required: true
2338
gpg-public-key:
2439
required: true
2540
gpg-key-pass:
2641
required: true
42+
es-username:
43+
description: SSL.com username for NuGet signing
44+
required: false
45+
es-password:
46+
description: SSL.com password for NuGet signing
47+
required: false
48+
credential-id:
49+
description: SSL.com credential ID for NuGet signing
50+
required: false
51+
es-totp-secret:
52+
description: SSL.com TOTP secret for NuGet signing
53+
required: false
54+
2755
permissions:
2856
contents: read
2957
packages: read
58+
3059
jobs:
3160
sign:
3261
runs-on: ubuntu-22.04
@@ -44,10 +73,54 @@ jobs:
4473
run: |
4574
sudo apt-get update && sudo apt-get install dpkg-sig dpkg-dev -y
4675
47-
- name: Sign Artifacts
76+
- name: Sign Artifacts with GPG
4877
run: |
4978
chmod +x ${{ github.workspace }}/.github/workflows/sign-artifacts/entrypoint.sh
5079
${{ github.workspace }}/.github/workflows/sign-artifacts/entrypoint.sh "${{ inputs.artifact-glob }}" "${{ inputs.output-dir }}"
80+
81+
- name: Check for NuGet packages and sign if enabled
82+
if: inputs.enable-nuget-signing
83+
run: |
84+
echo "Checking for NuGet packages..."
85+
NUGET_PACKAGES=$(find "${{ inputs.output-dir }}" -name "*.nupkg" -type f)
86+
if [ -n "$NUGET_PACKAGES" ]; then
87+
echo "Found NuGet packages, signing with SSL.com..."
88+
echo "$NUGET_PACKAGES" | while read -r file; do
89+
echo "Signing: $file"
90+
done
91+
else
92+
echo "No NuGet packages found"
93+
fi
94+
95+
- name: Sign NuGet Packages with SSL.com
96+
if: inputs.enable-nuget-signing
97+
uses: sslcom/esigner-codesign@a272724cb13abe0abc579c6c40f7899969b6942b
98+
with:
99+
command: sign
100+
username: ${{secrets.es-username}}
101+
password: ${{secrets.es-password}}
102+
credential_id: ${{secrets.credential-id}}
103+
totp_secret: ${{secrets.es-totp-secret}}
104+
file_path: ${{ inputs.output-dir }}/**/*.nupkg
105+
output_path: ${{github.workspace}}/${{ inputs.output-dir }}
106+
malware_block: false
107+
override: false
108+
environment_name: ${{ inputs.nuget-environment }}
109+
clean_logs: true
110+
jvm_max_memory: ${{ inputs.jvm-max-memory }}
111+
signing_method: v1
112+
113+
- name: Verify NuGet Packages (if NuGet signing was performed)
114+
if: inputs.enable-nuget-signing
115+
run: |
116+
echo "Verifying signed NuGet packages..."
117+
if [ -d "${{ inputs.output-dir }}" ]; then
118+
find "${{ inputs.output-dir }}" -name "*.nupkg" -type f | while read -r file; do
119+
echo "Verifying: $file"
120+
dotnet nuget verify "$file" --all || echo "Warning: Could not verify $file"
121+
done
122+
fi
123+
51124
- name: Upload Artifacts
52125
uses: actions/upload-artifact@v4
53126
with:

.github/workflows/sign-artifacts/entrypoint.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ echo "Processing all files in target directory: $TARGET_DIR"
4040
find "$TARGET_DIR" -type f | while read -r file; do
4141
echo "Processing: $file"
4242

43-
4443
# Skip signature and checksum files to prevent infinite loops
4544
if [[ "$file" =~ \.(asc|sha256)$ ]]; then
4645
continue
@@ -80,8 +79,13 @@ find "$TARGET_DIR" -type f | while read -r file; do
8079
# SHA256 checksum for signature file
8180
shasum -a 256 "$file.asc" > "$file.asc.sha256"
8281

83-
echo "Signed: $file"
82+
echo "GPG Signed: $file"
8483
echo " Signature: $file.asc"
8584
echo " Checksum: $file.sha256"
8685
echo " Sig Checksum: $file.asc.sha256"
86+
87+
# Note about NuGet packages
88+
if [[ "$ext" == "nupkg" ]]; then
89+
echo " Note: NuGet package detected - will be signed by SSL.com if enabled in workflow"
90+
fi
8791
done

.github/workflows/sign-nuget-package.yaml

Lines changed: 0 additions & 143 deletions
This file was deleted.

.vscode/settings.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
{
22
"yaml.schemas": {},
3-
"cSpell.words": [
4-
"aerospike",
5-
"kennylong",
6-
"kennylong's"
7-
],
3+
"cSpell.words": ["aerospike", "kennylong", "kennylong's"],
84
"postman.settings.dotenv-detection-notification-visibility": false
95
}

0 commit comments

Comments
 (0)