2021-05-04 18:58:36 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
# shellcheck disable=SC1090,SC1091
|
2021-05-05 12:59:28 +00:00
|
|
|
source "$SECRETS_PROJECT_ROOT/utils/build-utils.sh"
|
2021-05-06 14:47:41 +00:00
|
|
|
# shellcheck disable=SC1090,SC1091
|
|
|
|
source "$SECRETS_PROJECT_ROOT/utils/apk/meta.sh"
|
2021-05-04 18:58:36 +00:00
|
|
|
|
2021-05-05 12:59:28 +00:00
|
|
|
VERSION_NAME="git-secret-${SCRIPT_VERSION}.apk"
|
2021-05-04 18:58:36 +00:00
|
|
|
|
|
|
|
# Artifactory location:
|
|
|
|
BASE_API_URL='https://gitsecret.jfrog.io/artifactory'
|
|
|
|
|
|
|
|
|
|
|
|
function upload_with_architecture {
|
|
|
|
local arch="$1"
|
2021-05-06 14:47:41 +00:00
|
|
|
local file_location
|
|
|
|
file_location="$(locate_release 'apk' "$arch")"
|
2021-05-04 18:58:36 +00:00
|
|
|
|
|
|
|
curl -sS -u "$SECRETS_ARTIFACTORY_CREDENTIALS" \
|
|
|
|
--max-time 10 \
|
|
|
|
--retry 3 \
|
|
|
|
--retry-delay 5 \
|
|
|
|
-XPUT "$BASE_API_URL/git-secret-apk/all/main/$arch/$VERSION_NAME" \
|
2021-05-06 14:47:41 +00:00
|
|
|
-T "$file_location"
|
2021-05-04 18:58:36 +00:00
|
|
|
}
|
|
|
|
|
2021-05-06 14:47:41 +00:00
|
|
|
for architecture in "${ALPINE_ARCHITECTURES[@]}"; do
|
2021-05-04 18:58:36 +00:00
|
|
|
upload_with_architecture "$architecture"
|
|
|
|
done
|
|
|
|
|
|
|
|
# Now, we need to trigger metadata reindex:
|
|
|
|
curl -sS -u "$SECRETS_ARTIFACTORY_CREDENTIALS" \
|
|
|
|
--max-time 5 \
|
|
|
|
--retry 3 \
|
|
|
|
--retry-delay 5 \
|
|
|
|
-XPOST "$BASE_API_URL/api/alpine/git-secret-apk/reindex"
|
|
|
|
|
|
|
|
echo
|
2021-05-06 14:47:41 +00:00
|
|
|
echo 'Done: released alpine packages'
|