File tree Expand file tree Collapse file tree 1 file changed +64
-0
lines changed
Expand file tree Collapse file tree 1 file changed +64
-0
lines changed Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+ set -euo pipefail
3+
4+ SCRIPT_DIR=$( cd -- " $( dirname -- " ${BASH_SOURCE[0]} " ) " & > /dev/null && pwd )
5+ PROJECT_ROOT=$( dirname " ${SCRIPT_DIR} " )
6+
7+ usage () {
8+ local USAGE
9+ USAGE="
10+ Usage: $( basename " ${0} " ) [options] <cli|webui|openvsx> <version>
11+
12+ This scripts starts the release process for different components developed in this repository.
13+ Depending on the selected component, the repository will be tagged which triggers a workflow
14+ to build and publish the respective component.
15+
16+ Options:
17+
18+ -h show this help
19+ "
20+ echo " $USAGE "
21+ exit 1
22+ }
23+
24+
25+ while getopts " h:" o; do
26+ case " ${o} " in
27+ * )
28+ usage
29+ ;;
30+ esac
31+ done
32+
33+ COMPONENT=${*: $OPTIND : 1}
34+ VERSION=${*: $OPTIND +1: 1}
35+
36+ if [ -z " ${COMPONENT-} " ] || [ -z " ${VERSION-} " ]; then
37+ usage
38+ fi
39+
40+ COMPONENTS=(" cli" " webui" " openvsx" )
41+
42+ if ! [[ " ${COMPONENTS[*]} " =~ ${COMPONENT} ]]; then
43+ echo " Component '${COMPONENT} ' is not known."
44+ exit 1
45+ fi
46+
47+ echo " Releasing component ${COMPONENT} @${VERSION} ..."
48+
49+ echo " Checking for uncommitted changes..."
50+ git -C " ${PROJECT_ROOT} " status -s -uno | grep ' .' && exit 1
51+
52+ if [[ ${COMPONENT} = " openvsx" ]]; then
53+ TAG=" v${VERSION} "
54+ else
55+ TAG=" ${COMPONENT} -${VERSION} "
56+ fi
57+
58+ echo " Tagging repository with '${TAG} '..."
59+ git tag " ${TAG} "
60+
61+ echo " Pushing tags to origin..."
62+ git push --tags
63+
64+ echo " Done."
You can’t perform that action at this time.
0 commit comments