skip signing if env vars not in place

This commit is contained in:
nate smith 2022-01-14 16:32:56 -06:00
parent a23bdcd84d
commit e6b4fe632b
3 changed files with 12 additions and 3 deletions

View file

@ -9,7 +9,7 @@ before:
hooks:
- go mod tidy
- make manpages GH_VERSION={{.Version}}
- ./script/prepare-windows-cert.sh "{{.Env.GITHUB_CERT_PASSWORD}}" "{{.Env.DESKTOP_CERT_TOKEN}}"
- ./script/prepare-windows-cert.sh '{{ if index .Env "GITHUB_CERT_PASSWORD" }}{{ .Env.GITHUB_CERT_PASSWORD}}{{ end }}' '{{ if index .Env "DESKTOP_CERT_TOKEN" }}{{ .Env.DESKTOP_CERT_TOKEN}}{{ end }}'
builds:
- <<: &build_defaults
@ -35,7 +35,7 @@ builds:
goarch: [386, amd64]
hooks:
post:
- ./script/sign-windows-executable.sh {{ .Path }}
- ./script/sign-windows-executable.sh '{{ .Path }}'
archives:
- id: nix

View file

@ -4,6 +4,11 @@ set -e
GITHUB_CERT_PASSWORD=$1
DESKTOP_CERT_TOKEN=$2
if [[ -z "$GITHUB_CERT_PASSWORD" || -z "$DESKTOP_CERT_TOKEN" ]]; then
echo "skipping windows signing prep; cert password or token not found"
exit 0
fi
curl \
-H "Authorization: token $DESKTOP_CERT_TOKEN" \
-H "Accept: application/vnd.github.v3.raw" \

View file

@ -1,8 +1,12 @@
#!/bin/bash
set -e
EXECUTABLE_PATH=$1
if [[ ! -e certificate.pem || ! -e private-key.pem ]]; then
echo "skipping windows signing; cert or key not found"
exit 0
fi
EXECUTABLE_PATH=$1
ARCH="386"
if [[ $EXECUTABLE_PATH =~ "amd64" ]]; then