From 6ff5e79430ee0cea81c3d398f6acb8dfc8989cd4 Mon Sep 17 00:00:00 2001 From: heqnx Date: Sat, 12 Jul 2025 19:05:24 +0300 Subject: added .gitlab-ci.yml --- .gitlab-ci.yml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .gitlab-ci.yml (limited to '.gitlab-ci.yml') diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..236b28c --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,30 @@ +# source repo .gitlab-ci.yml +# requires a project access token (Project > Settings > Access tokens): +# - TOKEN with read_repository, write_repository; Role: Maintainer +# +# disable protected branch for Maintainer (Project > Settings > Repository): +# - main branch allowed to merge, allowed to push and merge maintainer; allowed to force push on +# +# requires the following gitlab variables (Project > Settings > CI/CD > Variables): +# - REPO_NAME: gitlab.com// (Protected, Masked, Expanded) +# - SOURCE_REPO: https://cgit.example.com/ (Protected, Masked, Expanded) +# - TOKEN: (Protected, Masked, Expanded) +# +stages: + - mirror + +mirror-from-cgit: + stage: mirror + image: ubuntu:20.04 + before_script: + - apt-get update -y && apt-get install -y git + - git config --global user.name "CI" + - git config --global user.email "ci@gitlab.com" + script: + - git clone --mirror "$SOURCE_REPO" temp_repo + - cd temp_repo + - TARGET_REPO="https://oauth2:$TOKEN@$REPO_NAME" + - git remote set-url origin "$TARGET_REPO" + - git push --prune --mirror + only: + - schedules -- cgit v1.2.3