Commit 85d1b05d authored by Michael R. Crusoe's avatar Michael R. Crusoe 🏳️‍🌈
Browse files

allow running on existing repos that weren't fully setup

parent 353cf0e2
Loading
Loading
Loading
Loading
+22 −7
Original line number Diff line number Diff line
@@ -36,6 +36,13 @@ if [ "$SALSA_GROUP_ID" = "" ] ; then
    exit 1
fi

# Did we already push to salsa?
set -x
RESPONSE=$(curl "$SALSA_URL/projects?search=${DEBPKGNAME}")
echo $RESPONSE | jq --exit-status "map(select(.path == \"${DEBPKGNAME}\")) | .[0].id" > /dev/null
set +x
if [ $? -ne 0 ]; then
    # Seems like not, lets create a project
    set -x
    RESPONSE=$(curl "$SALSA_URL/projects?private_token=$SALSA_TOKEN" \
        --data "path=${DEBPKGNAME}&namespace_id=${SALSA_GROUP_ID}&description=${SHORTDESC}&visibility=public")
@@ -45,8 +52,16 @@ check_return_code

    PROJECT_ID=$(echo $RESPONSE | jq '.id')
    set +x
else
    set -x
    PROJECT_ID=$(echo $RESPONSE | jq "map(select(.path == \"${DEBPKGNAME}\")) | .[0].id")
    set +x
fi

git remote show origin
if [ $? -ne 0 ] ; then
    git remote add origin git@salsa.debian.org:${SALSA_GROUP}/${DEBPKGNAME}.git
fi
git push origin master
git push --all --set-upstream
git push --tags