Be explicit with tag and commit ID on release

This commit is contained in:
Chris Roberts 2023-05-24 17:15:54 -07:00
parent 2092df529a
commit 72d528fa0e
2 changed files with 19 additions and 2 deletions

View File

@ -6,12 +6,27 @@ root="$( cd -P "$( dirname "$csource" )/../" && pwd )"
. "${root}/.ci/load-ci.sh"
if [ "${#}" -ne 2 ]; then
printf "Usage: %s TAG COMMIT_ID\n" "${0}" >&2
exit 1
fi
tag="${1}"
full_sha="${2}"
if [ -z "${tag}" ]; then
failure "Tag variable is unset (will be automatically set on tag push)"
failure "Tag variable is unset, required for release"
fi
if [ -z "${full_sha}" ]; then
failure "The full_sha variable is unexpectedly missing, cannot trigger release"
fi
# Trim the prefix of the tag if it hasn't been
if [[ "${tag}" = *"refs/tags"* ]]; then
debug "trimming tag reference value - %s" "${tag}"
tag="${tag##*refs/tags/}"
debug "trimmed tag value - %s" "${tag}"
fi
info "Triggering release %s (%s)" "${tag}" "${full_sha}"
github_repository_dispatch "vagrant-builders" "hashicorp-release" "commit_id=${full_sha}" "tag=${tag}"

View File

@ -11,6 +11,8 @@ jobs:
- name: Code Checkout
uses: actions/checkout@v3
- name: Trigger Build
run: ./.ci/release
run: ./.ci/release "${TAG}" "${COMMIT_ID}"
env:
HASHIBOT_TOKEN: ${{ secrets.HASHIBOT_TOKEN }}
TAG: ${{ github.ref }}
COMMIT_ID: ${{ github.sha }}