Repository navigation
65 lines (63 loc) · 2.59 KB
/
Copy pathrelease.yml
File metadata and controls
65 lines (63 loc) · 2.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
name: Signed Windows Release
on:
workflow_dispatch:
release:
types: [published]
jobs:
build-sign-and-checksum:
runs-on: windows-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install hash-locked dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements-dev.txt
- name: Locate SignTool and decode signing credential
shell: pwsh
env:
CODESIGN_PFX_BASE64: ${{ secrets.WINDOWS_CODESIGN_PFX_BASE64 }}
run: |
if (-not $env:CODESIGN_PFX_BASE64) { throw "WINDOWS_CODESIGN_PFX_BASE64 is required" }
[IO.File]::WriteAllBytes("$PWD\codesign.pfx", [Convert]::FromBase64String($env:CODESIGN_PFX_BASE64))
$signtool = Get-ChildItem "${env:ProgramFiles(x86)}\Windows Kits\10\bin\*\x64\signtool.exe" |
Sort-Object FullName -Descending | Select-Object -First 1
if (-not $signtool) { throw "signtool.exe was not found" }
"PDF_ESIGN_SIGNTOOL=$($signtool.FullName)" | Out-File -FilePath $env:GITHUB_ENV -Append
"PDF_ESIGN_CODESIGN_PFX=$PWD\codesign.pfx" | Out-File -FilePath $env:GITHUB_ENV -Append
- name: Build and Authenticode-sign
shell: cmd
env:
PDF_ESIGN_CODESIGN_PASSWORD: ${{ secrets.WINDOWS_CODESIGN_PASSWORD }}
PDF_ESIGN_TIMESTAMP_URL: ${{ vars.WINDOWS_CODESIGN_TIMESTAMP_URL }}
run: build.bat
- name: Package and checksum release
shell: pwsh
run: |
Compress-Archive -Path dist\PDF-eSign\* -DestinationPath dist\PDF-eSign-Windows.zip
$items = @(
"dist\PDF-eSign\PDF-eSign.exe",
"dist\PDF-eSign-Windows.zip"
)
$lines = foreach ($item in $items) {
$hash = (Get-FileHash -Algorithm SHA256 -LiteralPath $item).Hash.ToLower()
"$hash $([IO.Path]::GetFileName($item))"
}
$lines | Set-Content -Encoding ascii dist\SHA256SUMS.txt
Remove-Item -LiteralPath codesign.pfx -Force
- uses: actions/upload-artifact@v4
with:
name: PDF-eSign-Windows-signed
path: |
dist/PDF-eSign-Windows.zip
dist/SHA256SUMS.txt
- name: Attach files to published release
if: github.event_name == 'release'
shell: pwsh
env:
GH_TOKEN: ${{ github.token }}
run: gh release upload "${{ github.event.release.tag_name }}" dist/PDF-eSign-Windows.zip dist/SHA256SUMS.txt --clobber