diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index a5e8daf0..00000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,86 +0,0 @@ -stages: # List of stages for jobs, and their order of execution - - build - - test - - deploy - -variables: - GITHUB_REPOSITORY: - value: "github.com/MREYE-LUMC/ZOSPy.git" - description: "URL to the ZOSPy repository on GitHub." - - GITHUB_BRANCH_NAME: - value: "from_gitlab" - description: "Branch to create or update on GitHub." - GITHUB_COMMIT_MESSAGE: - value: "synchronize GitLab with GitHub" - description: "Commit message for the commit on GitHub." - - GITLAB_BRANCH_NAME: - value: "from_github" - description: "Branch to create or update on GitLab." - GITLAB_COMMIT_MESSAGE: - value: "synchronize GitHub with GitLab" - description: "Commit message for the commit on GitLab." - -gitlab-to-github: - image: "alpine:latest" - stage: deploy - when: manual - inherit: - variables: - - GITHUB_REPOSITORY - - GITHUB_BRANCH_NAME - - GITHUB_COMMIT_MESSAGE - script: - # Install dependencies - - apk update && apk add git rsync - # Clone the repository from GitHub - - git clone https://$GITHUB_REPOSITORY ../zospy-github - - cd ../zospy-github - # Create and checkout a branch for synchronization - - git checkout -b $GITHUB_BRANCH_NAME - # Try to pull the branch in case it already exists - - git pull origin $GITHUB_BRANCH_NAME || echo "branch $GITHUB_BRANCH_NAME does not yet exist on remote" - # Copy the files from the GitLab directory to the GitHub directory - - rsync -avh --progress --delete --exclude ".git" --exclude ".github" $CI_PROJECT_DIR/ ./ - # List the files in the GitHub directory (for debug purposes) - - ls -lah - # Settings for git - - git config user.email "$GITHUB_USER_EMAIL" && git config user.name "$GITHUB_USER_NAME" - # Add, commit, push new code - - git add . - - git commit -m "$GITHUB_COMMIT_MESSAGE" - - git push https://$GITHUB_ACCESS_TOKEN@$GITHUB_REPOSITORY - # Cleanup - - cd .. && rm -rf zospy-github - -github-to-gitlab: - image: "alpine:latest" - stage: deploy - when: manual - inherit: - variables: - - GITHUB_REPOSITORY - - GITLAB_BRANCH_NAME - - GITLAB_COMMIT_MESSAGE - script: - # Install dependencies - - apk update && apk add git rsync - # Clone the repository from GitHub - - git clone https://$GITHUB_REPOSITORY ../zospy-github - # Create and checkout a branch for synchronization - - git checkout -b $GITLAB_BRANCH_NAME - # Try to pull the branch in case it already exists - - git pull origin $GITLAB_BRANCH_NAME || echo "branch $GITLAB_BRANCH_NAME does not yet exist on remote" - # Copy the files from the GitHub directory to the GitLab directory - - rsync -avh --progress --delete --exclude ".git" ../zospy-github/ ./ - # List the files in the GitHub directory (for debug purposes) - - ls -lah - # Settings for git - - git config user.email "$GITLAB_USER_EMAIL" && git config user.name "$GITLAB_USER_NAME" - # Add, commit, push new code - - git add . - - git commit -m "$GITLAB_COMMIT_MESSAGE" - - git push https://gitlab-ci-push-token:${GITLAB_ACCESS_TOKEN}@git.lumc.nl/ophthalmology/virtualeyemodelling/zospy.git - # Cleanup - - cd .. && rm -rf zospy-github