Commit 8ab1aa08 authored by LAVENIER's avatar LAVENIER
Browse files

[fix] Fix deploy scripts

parent 3f92e414
...@@ -11,20 +11,24 @@ cd ${PROJECT_DIR} ...@@ -11,20 +11,24 @@ cd ${PROJECT_DIR}
### Variables ### Variables
task=$1 task=$1
release_description=$2 version=$2
release_description=$3
PROJECT_NAME=sumaris-pod PROJECT_NAME=sumaris-pod
REPO="sumaris-net/sumaris-pod" REPO="sumaris-net/sumaris-pod"
REPO_API_URL=https://api.github.com/repos/$REPO REPO_API_URL=https://api.github.com/repos/$REPO
REPO_PUBLIC_URL=https://github.com/$REPO REPO_PUBLIC_URL=https://github.com/$REPO
### Get version to release ### Get version to release
version=`grep -m1 -P "\<version>[0-9A−Z.]+(-\w*)?</version>" pom.xml | grep -oP "\d+.\d+.\d+(-\w*)?"`
if [[ "_$version" == "_" ]]; then if [[ "_$version" == "_" ]]; then
echo "ERROR: Unable to read 'version' in the file 'pom.xml'." version=`grep -m1 -P "\<version>[0-9A−Z.]+(-\w*)?</version>" pom.xml | grep -oP "\d+.\d+.\d+(-\w*)?"`
echo " - Make sure the file 'pom.xml' exists and is readable." if [[ "_$version" == "_" ]]; then
exit 1 echo "ERROR: Unable to read 'version' in the file 'pom.xml'."
echo " - Make sure the file 'pom.xml' exists and is readable."
exit 1
fi
echo "Project version (pom.xml): $version"
release_description=$2
fi fi
echo "Project version (pom.xml): $version"
### get auth token ### get auth token
if [[ "_${GITHUB_TOKEN}" == "_" ]]; then if [[ "_${GITHUB_TOKEN}" == "_" ]]; then
...@@ -53,15 +57,6 @@ case "$task" in ...@@ -53,15 +57,6 @@ case "$task" in
pre|rel) pre|rel)
### Control that the script is run on `dev` branch
branch=`git rev-parse --abbrev-ref HEAD`
echo "GIT branch: $branch"
if [[ ! "$branch" = "release/$version" ]];
then
echo ">> This script must be run under a release branch (release/$version)"
exit 1
fi
if [[ $1 = "pre" ]]; then if [[ $1 = "pre" ]]; then
prerelease="true" prerelease="true"
else else
...@@ -124,7 +119,7 @@ case "$task" in ...@@ -124,7 +119,7 @@ case "$task" in
missing_file=true missing_file=true
else else
artifact_name="sumaris-pod-$version.zip" artifact_name="sumaris-pod-$version.zip"
result=$(curl -s -H ''"$GITHUT_AUTH"'' -H 'Content-Type: application/zip' -T "${ZIP_FILE}" "${upload_url}?name=${ZIP_FILENAME}") result=$(curl -s -H ''"$GITHUT_AUTH"'' -H 'Content-Type: application/zip' -T "${ZIP_FILE}" "${upload_url}?name=${artifact_name}")
browser_download_url=`echo "$result" | grep -P "\"browser_download_url\":[ ]?\"[^\"]+" | grep -oP "\"browser_download_url\":[ ]?\"[^\"]+" | grep -oP "https://[A-Za-z0-9/.-]+"` browser_download_url=`echo "$result" | grep -P "\"browser_download_url\":[ ]?\"[^\"]+" | grep -oP "\"browser_download_url\":[ ]?\"[^\"]+" | grep -oP "https://[A-Za-z0-9/.-]+"`
SHA256=$(sha256sum "${ZIP_FILE}" | sed 's/ /\n/gi' | head -n 1) SHA256=$(sha256sum "${ZIP_FILE}" | sed 's/ /\n/gi' | head -n 1)
echo " - $browser_download_url | SHA256: ${SHA256}" echo " - $browser_download_url | SHA256: ${SHA256}"
......
...@@ -84,7 +84,7 @@ echo "" ...@@ -84,7 +84,7 @@ echo ""
echo "---- Uploading artifacts to Github..." echo "---- Uploading artifacts to Github..."
# Pause (wait propagation to from gitlab to github) # Pause (wait propagation to from gitlab to github)
echo " Waiting 40s, for propagation to github..." && sleep 40s echo " Waiting 40s, for propagation to github..." && sleep 40s
. ${PROJECT_DIR}/src/scripts/release-to-github.sh $task ''"$release_description"'' . ${PROJECT_DIR}/src/scripts/release-to-github.sh $task $version ''"$release_description"''
[[ $? -ne 0 ]] && exit 1 [[ $? -ne 0 ]] && exit 1
echo "---- Uploading artifacts to Github [OK]" echo "---- Uploading artifacts to Github [OK]"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment