Skip to content

Commit

Permalink
Fix draft releases
Browse files Browse the repository at this point in the history
Co-authored-by: Brend Smits <brend.smits@philips.com>
Signed-off-by: Marco Franssen <marco.franssen@philips.com>
  • Loading branch information
marcofranssen and Brend-Smits committed Feb 14, 2022
1 parent cdc0cb7 commit 5df3fa8
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions install-slsa-provenance.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ mkdir -p "${INSTALL_PATH}"
VERSION=v0.7.0-rc
RELEASE="https://github.com/philips-labs/slsa-provenance-action/releases/download/${VERSION}"

if [[ "$VERSION" == *-draft ]] ; then
html_url=$(curl -H "Authorization: token $GITHUB_TOKEN" -s https://api.github.com/repos/philips-labs/slsa-provenance-action/releases\?per_page\=10 | jq 'map(select(.name == "v0.6.2-draft"))' | jq -r '.[0].html_url')
RELEASE=${html_url/tag/download}
curl_args=(-H "Authorization: token $GITHUB_TOKEN")
fi

OS=${RUNNER_OS:-Linux}
ARCH=${RUNNER_ARCH:-X64}

Expand Down Expand Up @@ -66,13 +72,13 @@ trap "popd >/dev/null" EXIT
pushd "$INSTALL_PATH" > /dev/null || exit

log_info "Downloading ${ARCHIVE}"
curl -sLo "${ARCHIVE}" "${DOWNLOAD}"
curl "${curl_args[@]}" -sLo "${ARCHIVE}" "${DOWNLOAD}"

if [ -x "$(command -v cosign)" ] ; then
log_info "Downloading ${ARCHIVE}.sig"
curl -sLo slsa-provenance.sig "${DOWNLOAD}.sig"
curl "${curl_args[@]}" -sLo slsa-provenance.sig "${DOWNLOAD}.sig"
log_info "Downloading cosign.pub"
curl -sLo cosign.pub "$RELEASE/cosign.pub"
curl "${curl_args[@]}" -sLo cosign.pub "$RELEASE/cosign.pub"

log_info "Verifying signature…"
cosign verify-blob --key cosign.pub --signature slsa-provenance.sig "${ARCHIVE}"
Expand Down

0 comments on commit 5df3fa8

Please sign in to comment.