Skip to content

Commit 11e01a0

Browse files
committed
Moved the action from the .github repository to it's own repository.
0 parents  commit 11e01a0

4 files changed

Lines changed: 126 additions & 0 deletions

File tree

.config/dotnet-tools.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"version": 1,
3+
"isRoot": true,
4+
"tools": {
5+
"sign": {
6+
"version": "0.9.1-beta.26102.1",
7+
"commands": [
8+
"sign"
9+
]
10+
}
11+
}
12+
}

.github/dependabot.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "github-actions"
4+
directory: "/"
5+
schedule:
6+
interval: "weekly"
7+
- package-ecosystem: "nuget"
8+
directory: "/"
9+
schedule:
10+
interval: "weekly"

.github/workflows/main.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
on:
2+
workflow_dispatch:
3+
push:
4+
branches:
5+
- main
6+
7+
permissions:
8+
contents: read
9+
10+
name: main
11+
jobs:
12+
test-signing:
13+
name: Test code-signing action
14+
runs-on: windows-2025
15+
16+
permissions:
17+
contents: read
18+
id-token: write
19+
20+
steps:
21+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd #v6.0.2
22+
with:
23+
persist-credentials: false
24+
25+
- name: Prepare files to sign
26+
shell: cmd
27+
run: |
28+
mkdir files-to-sign
29+
copy %WINDIR%\system32\kernel32.dll files-to-sign
30+
31+
- name: Sign files
32+
uses: ./actions/code-signing
33+
with:
34+
client-id: ${{ secrets.AZURE_CLIENT_ID }}
35+
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
36+
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
37+
directory: ${{ github.workspace }}\files-to-sign

action.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: Code Signing
2+
description: Sign files using Azure Trusted Signing
3+
inputs:
4+
client-id:
5+
description: Azure Client ID
6+
tenant-id:
7+
description: Azure Tenant ID
8+
subscription-id:
9+
description: Azure Subscription ID
10+
directory:
11+
description: Directory containing files to sign
12+
required: true
13+
14+
runs:
15+
using: composite
16+
steps:
17+
- name: Check if signing should be performed
18+
id: should_sign
19+
shell: pwsh
20+
run: |
21+
$shouldSign = $true
22+
23+
if ("${{inputs.client-id}}" -eq "") {
24+
echo "Missing required value: client-id"
25+
$shouldSign = $false
26+
}
27+
28+
if ("${{inputs.tenant-id}}" -eq "") {
29+
echo "Missing required value: tenant-id"
30+
$shouldSign = $false
31+
}
32+
33+
if ("${{inputs.subscription-id}}" -eq "") {
34+
echo "Missing required value: subscription-id"
35+
$shouldSign = $false
36+
}
37+
38+
echo "should_sign=$shouldSign" >> $env:GITHUB_OUTPUT
39+
echo "Should sign: $shouldSign"
40+
41+
- name: Azure CLI login with federated credential
42+
if: steps.should_sign.outputs.should_sign == 'true'
43+
uses: azure/login@a457da9ea143d694b1b9c7c869ebb04ebe844ef5 # v2.3.0
44+
with:
45+
client-id: ${{ inputs.client-id }}
46+
tenant-id: ${{ inputs.tenant-id }}
47+
subscription-id: ${{ inputs.subscription-id }}
48+
49+
- name: Install sign cli
50+
if: steps.should_sign.outputs.should_sign == 'true'
51+
shell: cmd
52+
run: dotnet tool restore
53+
working-directory: ${{ github.action_path }}
54+
55+
- name: Sign executables and libraries
56+
if: steps.should_sign.outputs.should_sign == 'true'
57+
shell: pwsh
58+
run: |
59+
dotnet tool run sign code trusted-signing `
60+
--base-directory ${{ inputs.directory }} `
61+
--trusted-signing-account ImageMagick `
62+
--trusted-signing-certificate-profile ImageMagick2028 `
63+
--trusted-signing-endpoint https://wus2.codesigning.azure.net `
64+
--azure-credential-type azure-cli `
65+
--verbosity information `
66+
*.exe *.dll
67+
working-directory: ${{ github.action_path }}

0 commit comments

Comments
 (0)