+ version bump
Some checks failed
ci/woodpecker/push/db Pipeline was successful
ci/woodpecker/push/bff Pipeline failed
ci/woodpecker/push/billing_fees Pipeline failed
ci/woodpecker/push/chain_gateway Pipeline failed
ci/woodpecker/push/fx_ingestor Pipeline failed
ci/woodpecker/push/fx_oracle Pipeline failed
ci/woodpecker/push/ledger Pipeline failed
ci/woodpecker/push/nats Pipeline was successful
ci/woodpecker/push/notification Pipeline failed
ci/woodpecker/push/payments_orchestrator Pipeline failed
ci/woodpecker/push/bump_version unknown status
Some checks failed
ci/woodpecker/push/db Pipeline was successful
ci/woodpecker/push/bff Pipeline failed
ci/woodpecker/push/billing_fees Pipeline failed
ci/woodpecker/push/chain_gateway Pipeline failed
ci/woodpecker/push/fx_ingestor Pipeline failed
ci/woodpecker/push/fx_oracle Pipeline failed
ci/woodpecker/push/ledger Pipeline failed
ci/woodpecker/push/nats Pipeline was successful
ci/woodpecker/push/notification Pipeline failed
ci/woodpecker/push/payments_orchestrator Pipeline failed
ci/woodpecker/push/bump_version unknown status
This commit is contained in:
42
ci/scripts/common/bump_version.sh
Executable file
42
ci/scripts/common/bump_version.sh
Executable file
@@ -0,0 +1,42 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
REPO_ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
|
||||
cd "${REPO_ROOT}"
|
||||
|
||||
VERSION_FILE="./version"
|
||||
if [ ! -f "${VERSION_FILE}" ]; then
|
||||
echo "[bump-version] version file not found: ${VERSION_FILE}" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
CURRENT_VERSION="$(cat "${VERSION_FILE}")"
|
||||
NEXT_VERSION="$(printf '%s' "${CURRENT_VERSION}" | awk -F. -v OFS=. '
|
||||
NF==1 { print ++$NF; next }
|
||||
{
|
||||
$NF=sprintf("%0*d", length($NF), ($NF+1))
|
||||
print
|
||||
}')"
|
||||
|
||||
printf '%s\n' "${NEXT_VERSION}" > "${VERSION_FILE}"
|
||||
echo "[bump-version] ${CURRENT_VERSION} -> ${NEXT_VERSION}"
|
||||
|
||||
git add "${VERSION_FILE}"
|
||||
if git diff --cached --quiet; then
|
||||
echo "[bump-version] no changes staged, skipping commit"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
AUTHOR_NAME="${GIT_AUTHOR_NAME:-woodpecker}"
|
||||
AUTHOR_EMAIL="${GIT_AUTHOR_EMAIL:-ci@sendico.io}"
|
||||
git config user.name "${AUTHOR_NAME}"
|
||||
git config user.email "${AUTHOR_EMAIL}"
|
||||
|
||||
git commit -m "chore(ci): bump version to ${NEXT_VERSION}"
|
||||
|
||||
BRANCH="${WOODPECKER_BRANCH:-}"
|
||||
if [ -z "${BRANCH}" ] || [ "${BRANCH}" = "HEAD" ]; then
|
||||
BRANCH="$(git rev-parse --abbrev-ref HEAD)"
|
||||
fi
|
||||
|
||||
git push origin "HEAD:${BRANCH}"
|
||||
Reference in New Issue
Block a user