2020-07-29 18:54:47 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -ue
|
|
|
|
|
|
|
|
BIN="syft"
|
2024-05-06 19:14:43 +00:00
|
|
|
VERSION_FILE="VERSION"
|
|
|
|
VERSION=$1
|
2020-07-29 18:54:47 +00:00
|
|
|
|
2020-08-11 13:54:04 +00:00
|
|
|
# the source of truth as to whether we want to notify users of an update is if the release just created is NOT
|
|
|
|
# flagged as a pre-release on github
|
2021-03-11 17:41:10 +00:00
|
|
|
if [[ "$(curl -SsL https://api.github.com/repos/anchore/${BIN}/releases/tags/${VERSION} | jq .prerelease)" == "true" ]] ; then
|
|
|
|
echo "skipping publishing a version file (this is a pre-release: ${VERSION})"
|
2020-07-29 18:54:47 +00:00
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2024-05-06 19:14:43 +00:00
|
|
|
echo "creating and publishing version file (${VERSION})"
|
2020-07-29 18:54:47 +00:00
|
|
|
|
|
|
|
# create a version file for version-update checks
|
2021-03-11 17:41:10 +00:00
|
|
|
echo "${VERSION}" | tee "${VERSION_FILE}"
|
2020-07-29 18:54:47 +00:00
|
|
|
|
|
|
|
# upload the version file that supports the application version update check
|
2020-11-04 20:47:55 +00:00
|
|
|
export AWS_DEFAULT_REGION=us-west-2
|
|
|
|
aws s3 cp "${VERSION_FILE}" s3://toolbox-data.anchore.io/${BIN}/releases/latest/VERSION
|