testing ci #38
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: push | |
name: Testing action | |
jobs: | |
run_action: | |
runs-on: windows-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Copy libraries | |
shell: cmd | |
run: | | |
mkdir files | |
copy C:\Windows\System32\wmi.dll files | |
cd files | |
mkdir subdirectory | |
copy C:\Windows\System32\wmi.dll subdirectory | |
- name: Generate test certificate | |
id: generate-cert | |
shell: pwsh | |
run: | | |
$cert = New-SelfSignedCertificate -Type CodeSigningCert -KeyUsageProperty Sign -KeyUsage DigitalSignature ` | |
-KeyExportPolicy ExportableEncrypted -KeyProtection None -KeyAlgorithm RSA -KeyLength 2048 ` | |
-KeyDescription "Certificate to test code signing action" -FriendlyName "TestCert" -Subject "[email protected],CN=Test Certificate" ` | |
-CertStoreLocation "Cert:\CurrentUser\My\" | |
$password = 'ThisIsASuperLongPassword' | |
$securedPwd = ConvertTo-SecureString -String $password -Force -AsPlainText | |
$pfxFile = 'testCert.pfx' | |
Export-PfxCertificate -FilePath $pfxFile -Password $securedPwd -Cert "Cert:\CurrentUser\My\$($cert.Thumbprint)" -Force | |
$base64PfxCert = [convert]::ToBase64String((Get-Content -path $pfxFile -AsByteStream)) | |
echo "certificate=${base64PfxCert}" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append | |
echo "certSha1=$($cert.Thumbprint)" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append | |
echo "certPassword=${password}" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append | |
- name: Run the action | |
uses: ./ | |
with: | |
certificate: '${{ steps.generate-cert.outputs.certificate }}' | |
certificatesha1: '${{ steps.generate-cert.outputs.certSha1 }}' | |
password: '${{ steps.generate-cert.outputs.certPassword }}' | |
folder: 'files' | |
recursive: true |