-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathrelease
executable file
·37 lines (35 loc) · 1.21 KB
/
release
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
#!/usr/bin/env bash
cd "$(dirname ${BASH_SOURCE[0]})"
source maven.bash
version=$(mavenProjectVersion "pom.xml")
repository="ghcr.io/jvanzyl/provisio/provisio"
if echo "${version}" | grep SNAPSHOT ; then
# 0.0.X-SNAPSHOT --> 0.0.X
version=$(echo ${version} | sed -e 's/-SNAPSHOT//')
jenv exec ./mvnw versions:set -DnewVersion="${version}"
rm -f pom.xml.versionsBackup
# Update all the descriptors
(cd src/main/resources/provisioRoot; ./gather)
git add pom.xml src/main/resources; git commit -m "Release ${version}"; git tag ${version}; git push && git push --tags
# Build the release
jenv exec ./mvnw clean install
docker buildx create --use
docker buildx build \
-f Dockerfile.java \
-t ${repository}:${version} \
-t ${repository}:latest \
--build-arg=MAVEN_VERSION=${version} \
--platform=linux/arm64,linux/amd64 \
--push \
.
# 0.0.X --> X
version="$(echo ${version} | sed -e 's/0.0.//')"
# X --> 0.0.X+1-SNAPSHOT
version="0.0.$((version+1))-SNAPSHOT"
jenv exec ./mvnw versions:set -DnewVersion="${version}"
rm -f pom.xml.versionsBackup
git add pom.xml; git commit -m "Development ${version}"; git push
else
echo "${version} is not a SNAPSHOT. Exiting."
exit
fi