Verified Commit 3f59c3de authored by Laurent Heirendt's avatar Laurent Heirendt
Browse files

set deploy mechanism using token

parent c38709fc
#!/bin/bash
# for your information
whoami
printenv
# we need to extract the ssh/git URL as the runner uses a tokenized URL
export CI_PUSH_REPO=`echo $CI_BUILD_REPO | perl -pe 's#.*@(.+?(\:\d+)?)/#git@\1:#'`
# runner runs on a detached HEAD, create a temporary local branch for editing
git checkout -b tmpBranch
git config --global user.name "artenobot"
git config --global user.email "artenobot@uni.lu"
git remote set-url --push origin "${CI_PUSH_REPO}"
# commit
git commit -am "Update models"
# push changes
# always return true so that the build does not fail if there are no changes
git push origin tmpBranch:${CI_BUILD_REF_NAME} || true
......@@ -18,5 +18,13 @@ commit:
rules:
- if: $CI_COMMIT_BRANCH == "build-ci"
- if: $CI_COMMIT_BRANCH == "master"
before_script:
- url_host=`git remote get-url origin | sed -e "s/https:\/\/gitlab-ci-token:.*@//g"`
- git checkout -b $CI_COMMIT_REF_NAME
- git remote set-url origin "https://$GIT_ACCESS_USER:$GIT_ACCESS_PASSWORD@${url_host}"
- git config user.name $GIT_ACCESS_USER
- git config user.email $GIT_ACCESS_EMAIL
script:
- sh .ci/deploy.sh
\ No newline at end of file
- git commit -am "Update models"
- git push origin $CI_COMMIT_REF_NAME
\ No newline at end of file
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