Added the automatic creation of Git Repository

This commit is contained in:
Luca Frosini 2019-07-23 12:15:37 +02:00
parent e6601aa7c3
commit 144f7161b4
1 changed files with 38 additions and 2 deletions

View File

@ -10,6 +10,7 @@ AUTHORS_OK=false
POM_FILE=pom.xml
OLD_MAVEN_PARENT_VERSION="1.0.0"
NEW_MAVEN_PARENT_VERSION="1.1.0-SNAPSHOT"
GITEA_TOKEN=""
function git_repository {
local GIT_OK=false
@ -24,7 +25,7 @@ function git_repository {
GIT_OK=true;
break;;
No )
echo "Please created it at https://code-repo.d4science.org/repo/create?org=5722 and select yes to continue. See how to do it at https://wiki.gcube-system.org/gcube/Git_Repositories#Create_a_New_Repository"
git_create_repository
GIT_OK=false
break;;
Abort )
@ -35,6 +36,40 @@ function git_repository {
done
}
function git_create_repository {
local GIT_CREATE_OK=false
if [[ -z "$GITEA_TOKEN" ]]; then
echo "Please initialize GITEA_TOKEN first";
exit
fi
while [ "$GIT_CREATE_OK" = false ]
do
echo "Do you want automatically create https://code-repo.d4science.org/gCubeSystem/${GIT_REPOSITORY_DIRECTORY_NAME}.git repository?"
select yna in "Yes" "No" "Abort";
do
case $yna in
Yes )
curl -X POST "https://code-repo.d4science.org/api/v1/org/gCubeSystem/repos?access_token=$GITEA_TOKEN" -H "accept: application/json" -H "content-type: application/json" -d "{\"name\":\"${GIT_REPOSITORY_DIRECTORY_NAME}\"}"
GIT_CREATE_OK=true;
break;;
No )
echo "Please created it at https://code-repo.d4science.org/repo/create?org=5722 and select yes to continue. See how to do it at https://wiki.gcube-system.org/gcube/Git_Repositories#Create_a_New_Repository"
git_repository
GIT_CREATE_OK=true
break;;
Abort )
exit;;
esac
done
done
}
function authors {
if [ "$AUTHORS_OK" = false ]; then
read -p "By continuing you will be able to check the authors file with 'less' command (type ENTER to continue)."
@ -247,7 +282,8 @@ cd $GIT_REPOSITORY_DIRECTORY_NAME
CREATED_GIT_DIRECTORY="$(pwd)"
echo "Git Repository directory $CREATED_GIT_DIRECTORY"
git branch
git remote add origin "https://code-repo.d4science.org/gCubeSystem/${GIT_REPOSITORY_DIRECTORY_NAME}.git"
#git remote add origin "https://code-repo.d4science.org/gCubeSystem/${GIT_REPOSITORY_DIRECTORY_NAME}.git"
git remote add origin "gitea@code-repo.d4science.org:gCubeSystem/${GIT_REPOSITORY_DIRECTORY_NAME}.git"
git remote -v
push