actual version bump support
This commit is contained in:
5 files changed
+351
-109
No files matched your search
+3
-44
@@ -43,7 +43,6 @@ stages:
|
||||
|
||||
variables:
|
||||
GIT_CLEAN_FLAGS: -fdx
|
||||
GIT_DEPTH: 0
|
||||
|
||||
# ── Build split runner images and push to registry ─────────────────────────────
|
||||
.build-docker-base:
|
||||
@@ -500,7 +499,7 @@ update-wiki:
|
||||
when: on_success
|
||||
- when: never
|
||||
|
||||
# ── Auto-tag release patch version at end of successful master pipeline ─────────
|
||||
# ── Bump VERSION, commit [skip ci], tag release, & rotate token if expiring ──
|
||||
bump-version:
|
||||
stage: release
|
||||
tags:
|
||||
@@ -514,48 +513,8 @@ bump-version:
|
||||
optional: true
|
||||
- update-wiki
|
||||
script:
|
||||
- |
|
||||
if [ "${CI_COMMIT_BRANCH:-}" != "master" ]; then
|
||||
echo "Skipping version tag: branch is '${CI_COMMIT_BRANCH:-unknown}', not 'master'."
|
||||
exit 0
|
||||
fi
|
||||
if [ -z "${GITLAB_TOKEN:-}" ]; then
|
||||
echo "ERROR: GITLAB_TOKEN CI/CD variable is not set"
|
||||
exit 1
|
||||
fi
|
||||
- chmod +x scripts/compute-version.sh
|
||||
- ASTERIA_VERSION="$(./scripts/compute-version.sh)"
|
||||
- TAG_NAME="v${ASTERIA_VERSION}"
|
||||
- API_URL="${CI_API_V4_URL:-https://gitlab.com/api/v4}/projects/${CI_PROJECT_ID}"
|
||||
- ENCODED_TAG="$(jq -rn --arg t "${TAG_NAME}" '$t|@uri')"
|
||||
- |
|
||||
EXISTS_CODE=$(curl -s -o /dev/null -w '%{http_code}' \
|
||||
--header "PRIVATE-TOKEN: ${GITLAB_TOKEN}" \
|
||||
"${API_URL}/repository/tags/${ENCODED_TAG}")
|
||||
if [ "${EXISTS_CODE}" = "200" ]; then
|
||||
echo "Tag ${TAG_NAME} already exists; skipping creation."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
PAYLOAD=$(jq -n \
|
||||
--arg tag "${TAG_NAME}" \
|
||||
--arg ref "${CI_COMMIT_SHA}" \
|
||||
--arg msg "Release ${TAG_NAME} (pipeline #${CI_PIPELINE_ID})" \
|
||||
'{tag_name: $tag, ref: $ref, message: $msg}')
|
||||
|
||||
CREATE_CODE=$(curl -s -o /tmp/tag_resp.json -w '%{http_code}' -X POST \
|
||||
--header "PRIVATE-TOKEN: ${GITLAB_TOKEN}" \
|
||||
--header "Content-Type: application/json" \
|
||||
--data "${PAYLOAD}" \
|
||||
"${API_URL}/repository/tags")
|
||||
|
||||
if [ "${CREATE_CODE}" = "201" ] || [ "${CREATE_CODE}" = "200" ]; then
|
||||
echo "Created release tag ${TAG_NAME} at ${CI_COMMIT_SHA}"
|
||||
else
|
||||
echo "ERROR: Failed to create tag ${TAG_NAME} (HTTP ${CREATE_CODE})"
|
||||
cat /tmp/tag_resp.json
|
||||
exit 1
|
||||
fi
|
||||
- chmod +x scripts/bump-version.sh
|
||||
- ./scripts/bump-version.sh
|
||||
rules:
|
||||
- if: $CI_PIPELINE_TYPE == "image-rebuild"
|
||||
when: never
|
||||
|
||||
Reference in new issue
Block a user