Added the automatic creation of Git Repository
This commit is contained in:
parent
e6601aa7c3
commit
144f7161b4
|
@ -10,6 +10,7 @@ AUTHORS_OK=false
|
||||||
POM_FILE=pom.xml
|
POM_FILE=pom.xml
|
||||||
OLD_MAVEN_PARENT_VERSION="1.0.0"
|
OLD_MAVEN_PARENT_VERSION="1.0.0"
|
||||||
NEW_MAVEN_PARENT_VERSION="1.1.0-SNAPSHOT"
|
NEW_MAVEN_PARENT_VERSION="1.1.0-SNAPSHOT"
|
||||||
|
GITEA_TOKEN=""
|
||||||
|
|
||||||
function git_repository {
|
function git_repository {
|
||||||
local GIT_OK=false
|
local GIT_OK=false
|
||||||
|
@ -24,7 +25,7 @@ function git_repository {
|
||||||
GIT_OK=true;
|
GIT_OK=true;
|
||||||
break;;
|
break;;
|
||||||
No )
|
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
|
GIT_OK=false
|
||||||
break;;
|
break;;
|
||||||
Abort )
|
Abort )
|
||||||
|
@ -35,6 +36,40 @@ function git_repository {
|
||||||
done
|
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 {
|
function authors {
|
||||||
if [ "$AUTHORS_OK" = false ]; then
|
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)."
|
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)"
|
CREATED_GIT_DIRECTORY="$(pwd)"
|
||||||
echo "Git Repository directory $CREATED_GIT_DIRECTORY"
|
echo "Git Repository directory $CREATED_GIT_DIRECTORY"
|
||||||
git branch
|
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
|
git remote -v
|
||||||
|
|
||||||
push
|
push
|
||||||
|
|
Loading…
Reference in New Issue