Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sign using certificate during CI build #397

Merged
merged 7 commits into from
Aug 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
23 changes: 20 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,21 +127,38 @@ jobs:
run: |
$env:PATH = "C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem"
C:\tools\msys64\usr\bin\bash -lc "win-installer/build-installer.sh"
- name: Decode the certificate
run: |
$pfx_cert_byte = [System.Convert]::FromBase64String("${{ secrets.Base64_Encoded_Pfx }}")
$currentDirectory = Get-Location
$certificatePath = Join-Path -Path $currentDirectory -ChildPath 'certificate.pfx'
[IO.File]::WriteAllBytes("$certificatePath", $pfx_cert_byte)
- name: Add SignTool to Path
run: echo "::add-path::C:\Program Files (x86)\Windows Kits\10\bin\10.0.17763.0\x86"
- name: Sign executables
env:
password: '${{ secrets.CERTPASSWORD }}'
timestampUrl: http://timestamp.digicert.com
installer: 'win-installer/output/gaphor-${{ steps.meta.outputs.version }}-installer.exe'
portable: 'win-installer/output/gaphor-${{ steps.meta.outputs.version }}-portable.exe'
run: signtool.exe sign /f 'certificate.pfx' /tr $env:timestampUrl /td sha256 /fd sha256 /p $env:password $env:installer $env:portable
- name: Remove certificate
run: Remove-Item 'certificate.pfx'
- name: Upload gaphor-${{ steps.meta.outputs.version }}-installer.exe
uses: actions/upload-artifact@v2
with:
name: gaphor-${{ steps.meta.outputs.version }}-installer.exe
path: win-installer/gaphor-${{ steps.meta.outputs.version }}-installer.exe
path: win-installer/output/gaphor-${{ steps.meta.outputs.version }}-installer.exe
- name: Upload gaphor-${{ steps.meta.outputs.version }}-portable.exe
uses: actions/upload-artifact@v2
with:
name: gaphor-${{ steps.meta.outputs.version }}-portable.exe
path: win-installer/gaphor-${{ steps.meta.outputs.version }}-portable.exe
path: win-installer/output/gaphor-${{ steps.meta.outputs.version }}-portable.exe
- name: Upload Assets
uses: AButler/upload-release-assets@v2.0
if: github.event_name == 'release'
with:
files: 'win-installer/*.exe'
files: 'win-installer/output/*.exe'
repo-token: ${{ secrets.GITHUB_TOKEN }}


Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,10 @@ pip-wheel-metadata
win-installer/gaphor-script.py
win-installer/_build_root
win-installer/file_version_info.txt
win-installer/output

# MacOS
package/gaphor.iconset/

# Vagrant
.vagrant
.vagrant
5 changes: 3 additions & 2 deletions win-installer/build-installer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ ARCH="x86_64"

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "${DIR}"
mkdir -p output
source ../venv

MISC="${DIR}"/misc
Expand Down Expand Up @@ -51,11 +52,11 @@ function build_installer {
cp "${DIR}"/misc/gaphor.ico "${DIST_LOCATION}"
(cd "${DIST_LOCATION}" && makensis -NOCD -DVERSION="$VERSION" "${MISC}"/win_installer.nsi)

mv "${DIST_LOCATION}/gaphor-LATEST.exe" "$DIR/gaphor-$VERSION-installer.exe"
mv "${DIST_LOCATION}/gaphor-LATEST.exe" "$DIR/output/gaphor-$VERSION-installer.exe"
}

function build_portable_installer {
local PORTABLE="$DIR/gaphor-$VERSION-portable"
local PORTABLE="$DIR/output/gaphor-$VERSION-portable"

rm -rf "$PORTABLE"
mkdir "$PORTABLE"
Expand Down