Skip to content
Snippets Groups Projects
Commit 713ccea5 authored by Benoit Lavenier's avatar Benoit Lavenier
Browse files

prepare next version

parent f1242b2a
No related branches found
No related tags found
No related merge requests found
Pipeline #4208 passed
......@@ -4,7 +4,7 @@
<parent>
<groupId>org.duniter.cesium</groupId>
<artifactId>cesium-plus-pod</artifactId>
<version>1.1.3-SNAPSHOT</version>
<version>1.1.3</version>
</parent>
<artifactId>cesium-plus-pod-assembly</artifactId>
......
......@@ -4,7 +4,7 @@
<parent>
<groupId>org.duniter.cesium</groupId>
<artifactId>cesium-plus-pod</artifactId>
<version>1.1.3-SNAPSHOT</version>
<version>1.1.3</version>
</parent>
<artifactId>cesium-plus-pod-core</artifactId>
......
......@@ -4,7 +4,7 @@
<parent>
<groupId>org.duniter.cesium</groupId>
<artifactId>cesium-plus-pod</artifactId>
<version>1.1.3-SNAPSHOT</version>
<version>1.1.3</version>
</parent>
<artifactId>cesium-plus-pod-subscription</artifactId>
......
......@@ -3,7 +3,7 @@
<parent>
<artifactId>cesium-plus-pod</artifactId>
<groupId>org.duniter.cesium</groupId>
<version>1.1.3-SNAPSHOT</version>
<version>1.1.3</version>
</parent>
<modelVersion>4.0.0</modelVersion>
......
#!/bin/bash
### Control that the script is run on `dev` branch
branch=`git rev-parse --abbrev-ref HEAD`
if [[ "$branch" = "master" ]];
then
echo ">> This script must be run under a branch (tag)"
exit 1
fi
### Get version to release
current=`grep -m1 -P "\<version>[0-9A−Z.]+(-\w*)?</version>" pom.xml | grep -oP "\d+.\d+.\d+(-\w*)?"`
echo "Current version: $current"
### Get repo URL
REMOTE_URL=`git remote -v | grep -P "push" | grep -oP "(https:\/\/github.com\/|git@github.com:)[^ ]+"`
REPO=`echo $REMOTE_URL | sed "s/https:\/\/github.com\///g" | sed "s/git@github.com://g" | sed "s/.git$//"`
REPO_URL=https://api.github.com/repos/$REPO
### get auth token
GITHUB_TOKEN=`cat ~/.config/duniter/.github`
if [[ "_$GITHUB_TOKEN" != "_" ]]; then
GITHUT_AUTH="Authorization: token $GITHUB_TOKEN"
else
echo "Unable to find github authentication token file: "
echo " - You can create such a token at https://github.com/settings/tokens > 'Generate a new token'."
echo " - Then copy the token and paste it in the file '~/.config/duniter/.github' using a valid token."
exit 1
fi
case "$1" in
del)
result=`curl -i "$REPO_URL/releases/tags/v$current"`
release_url=`echo "$result" | grep -P "\"url\": \"[^\"]+" | grep -oP "$REPO_URL/releases/\d+"`
if [[ $release_url != "" ]]; then
echo "Deleting existing release..."
curl -H 'Authorization: token $GITHUB_TOKEN' -XDELETE $release_url
fi
;;
pre|rel)
if [[ $1 = "pre" ]]; then
prerelease="true"
else
prerelease="false"
fi
description=`echo $2`
if [[ "_$description" = "_" ]]; then
description="Release v$current"
fi
result=`curl -s -H ''"$GITHUT_AUTH"'' "$REPO_URL/releases/tags/v$current"`
release_url=`echo "$result" | grep -P "\"url\": \"[^\"]+" | grep -oP "https://[A-Za-z0-9/.-]+/releases/\d+"`
if [[ "_$release_url" != "_" ]]; then
echo "Deleting existing release... $release_url"
result=`curl -H ''"$GITHUT_AUTH"'' -s -XDELETE $release_url`
if [[ "_$result" != "_" ]]; then
error_message=`echo "$result" | grep -P "\"message\": \"[^\"]+" | grep -oP ": \"[^\"]+\""`
echo "Delete existing release failed with error$error_message"
exit 1
fi
else
echo "Release not exists yet on github."
fi
echo "Creating new release..."
echo " - tag: v$current"
echo " - description: $description"
result=`curl -H ''"$GITHUT_AUTH"'' -s $REPO_URL/releases -d '{"tag_name": "v'"$current"'","target_commitish": "master","name": "v'"$current"'","body": "'"$description"'","draft": false,"prerelease": '"$prerelease"'}'`
upload_url=`echo "$result" | grep -P "\"upload_url\": \"[^\"]+" | grep -oP "https://[A-Za-z0-9/.-]+"`
### Sending files
echo "Uploading files... to $upload_url"
dirname=`pwd`
result=`curl -s -H ''"$GITHUT_AUTH"'' -H 'Content-Type: application/zip' -T "$dirname/cesium-plus-pod-assembly/target/cesium-plus-pod-$current-standalone.jar" "$upload_url?name=cesium-plus-pod-$current-standalone.jar"`
browser_download_url=`echo "$result" | grep -P "\"browser_download_url\":[ ]?\"[^\"]+" | grep -oP "\"browser_download_url\":[ ]?\"[^\"]+" | grep -oP "https://[A-Za-z0-9/.-]+"`
echo " - $browser_download_url"
echo "-----------------------------------------"
echo "Successfully uploading files to github !"
;;
*)
echo "Missing arguments"
echo "Usage:"
echo " > ./github.sh del|pre|rel <release_description>"
echo "With:"
echo " - del: delete existing release"
echo " - pre: use for pre-release"
echo " - rel: for full release"
exit 1
;;
esac
#!/bin/bash
echo "**********************************"
echo "* Preparing release..."
echo "**********************************"
result=`mvn release:clean`
failure=`echo "$result" | grep -m1 -P "\[INFO\] BUILD FAILURE" | grep -oP "BUILD \w+"`
# prepare failed
if [[ ! "_$failure" = "_" ]]; then
echo "$result" | grep -P "\[ERROR\] "
exit 1
fi
mvn release:prepare --quiet
if [ $? -ne 0 ]; then
exit 1
fi
echo "**********************************"
echo "* Performing release..."
echo "**********************************"
mvn release:perform --quiet
if [ $? -ne 0 ]; then
exit 1
fi
echo "**********************************"
echo "* Uploading artifacts to Github..."
echo "**********************************"
cd $dirname/target/checkout
./github.sh pre
if [ $? -ne 0 ]; then
exit 1
fi
echo "RELEASE finished !"
......@@ -78,7 +78,7 @@
<menu name="${project.name}" inherit="top">
<item name="Home" href="./index.html"/>
<item name="Downloads"
href="https://github.com/duniter/duniter4j/releases"/>
href="https://github.com/duniter/cesium-plus-pod/releases"/>
</menu>
<menu name="User manual" inherit="top">
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment