-
Notifications
You must be signed in to change notification settings - Fork 103
/
release.sh
executable file
·49 lines (41 loc) · 1.61 KB
/
release.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/bash
if [ ! -f "$HOME/bin/grab" ]; then
mkdir -p $HOME/bin
export PATH=$PATH:$HOME/bin
curl -o $HOME/bin/grab -L https://github.com/shellib/grab/raw/master/grab.sh && chmod +x $HOME/bin/grab
fi
source $(grab github.com/shellib/cli)
source $(grab github.com/shellib/maven as maven)
release_version=$(readopt --release-version $*)
if [ -z $release_version ]; then
echo "Option --release_version is required!"
exit 1
fi
function set_version() {
local file=$1
docker run -v `pwd`:/ws --workdir=/ws -i quay.io/jbangdev/jbang-action ./scripts/ChangeVersion.java ${file} io.dekorate $release_version > ${file}.versionChanged
tail -n +2 ${file}.versionChanged > ${file}
rm ${file}.versionChanged
git add ${file}
}
# Regenerate boms and set release version
mvn io.sundr:sundr-maven-plugin:0.101.1:generate-bom
cp -r target/classes/dekorate-bom/pom.xml boms/dekorate-bom/pom.xml
set_version boms/dekorate-bom/pom.xml
cp -r target/classes/dekorate-spring-bom/pom.xml boms/dekorate-spring-bom/pom.xml
set_version boms/dekorate-spring-bom/pom.xml
# Update the docs with the release version
set_version readme.md io.dekorate $release_version
ls docs/documentation/*.md | while read doc; do
set_version $doc io.dekorate $release_version
done
# Update site version
cp .github/project.yml docs/_data/project.yml
git add docs
git commit -m "doc: Update dekorate version in docs to $release_version"
mvn versions:set -DnewVersion=$release_version -Pwith-examples
git add examples
git commit -m "chore: Set examples version to $release_version"
git stash save --keep-index --include-untracked
git stash drop
maven::release $*