Skip to content

Commit

Permalink
chore: Add version tagging script for feature releases
Browse files Browse the repository at this point in the history
Creating tags only, not intended for creating releases.
  • Loading branch information
hankei6km committed Dec 17, 2023
1 parent 2fa513e commit ffcb626
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions scripts/ver-tag.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/bash
set -e

# exmaple:
# scripts/ver-tag.sh [feature-name] patch
# scripts/ver-tag.sh [feature-name] prelease pre-.

FEATURE="${1}"
RANGE="${2}"
PREREL="${3}"
test -n "${FEATURE}" || { echo "Missing feature name"; exit 1; }

LATEST="$(jq -r '.version' "src/${FEATURE}/devcontainer-feature.json")"

VERSION="$(
if [ "${RANGE}" = "prelease" ]; then
semver bump "${RANGE}" "${PREREL}}" "${LATEST}"
else
semver bump "${RANGE}" "${LATEST}"
fi
)"
echo "New version: ${VERSION}"

# Update devcontainer-feature.json
jq ".version = \"${VERSION}\"" "src/${FEATURE}/devcontainer-feature.json" > "src/${FEATURE}/devcontainer-feature.json.tmp"
mv "src/${FEATURE}/devcontainer-feature.json.tmp" "src/${FEATURE}/devcontainer-feature.json"

git add "src/${FEATURE}/devcontainer-feature.json"
MESSAGE="feature-${FEATURE}-${VERSION}"
git commit -m "${MESSAGE}"
git tag "${MESSAGE}" -am "${MESSAGE}"

echo "Operations for release:"
echo "- git push --follow-tags origin"
echo "- Run the release workflow on GitHub"

0 comments on commit ffcb626

Please sign in to comment.