Skip to content
award

GitHub Action

Code sign a file in Windows using pfx certificate

v1.02 Latest version

Code sign a file in Windows using pfx certificate

award

Code sign a file in Windows using pfx certificate

Sign a file with a pfx certificate

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Code sign a file in Windows using pfx certificate

uses: markeytos/code-sign-action@v1.02

Learn more about this action in markeytos/code-sign-action

Choose a version

Thank you to Gateway Apps for providing a base for me to create this action.

Code sign a file

This action signs files that are supported by signtool.exe with a code signing certificate that takes in a password. This action only works on Windows and that means it should run on windows-latest.

Inputs

certificate

Required The base64 encoded certificate.

to get the base 64 encoded certificate of the PFX file, run the following in powershell:

$fileContentBytes = get-content 'YOURFILEPATH.pfx' -Encoding Byte
[System.Convert]::ToBase64String($fileContentBytes)

password

Required Certificate Password. Used to add to the machine store.

certificatesha1

Required SHA1 hash for the certificate. You can obtain this from Microsoft Management Console after double clicking on your certificate (called Thumbprint). This and/or the certificatename is required for the signing to be successful.

certificatename

Required The name of the certificate. This and/or the certificatesha1 is required for the signing to be successful.

folder

Required The folder that contains the libraries to sign.

recursive

Optional Recursively search for DLL files.

timestampUrl

Optional Url of the timestamp server. Default is 'http://timestamp.verisign.com/scripts/timstamp.dll'

Example usage

runs-on: windows-latest
steps:
  uses: markeytos/code-sign-action@v1
  with:
    certificate: '${{ secrets.CERTIFICATE }}'
    password: '${{ secrets.PASSWORD }}'
    certificatesha1: '${{ secrets.CERTHASH }}'
    certificatename: '${{ secrets.CERTNAME }}'
    timestampUrl: 'http://timestamp.digicert.com'
    folder: 'files'
    recursive: true