From 26d2cc6e81892ed1215cfd98782aff91881dd91e Mon Sep 17 00:00:00 2001 From: Rodrigo Motta Date: Sat, 23 Mar 2024 16:21:28 -0300 Subject: [PATCH] Initialize Gitlab mirror --- .github/workflows/init_mirror.yml | 36 +++++++++++++++++++++++++++++++ .github/workflows/mirror.yml | 32 +++++++++++++++++++++++++++ .gitignore | 4 +--- .gitlab-ci.yml | 14 ++++++++++++ README.md | 18 ++++++++++++++-- 5 files changed, 99 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/init_mirror.yml create mode 100644 .github/workflows/mirror.yml create mode 100644 .gitlab-ci.yml diff --git a/.github/workflows/init_mirror.yml b/.github/workflows/init_mirror.yml new file mode 100644 index 0000000..3d01eb2 --- /dev/null +++ b/.github/workflows/init_mirror.yml @@ -0,0 +1,36 @@ +name: Initialize Gitlab mirror + +on: + push: + branches: + - main + +jobs: + sync_to_gitlab: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Extract repository name + id: extract_repo_name + run: echo "::set-output name=reponame::$(echo $GITHUB_REPOSITORY | cut -d'/' -f2)" + + - name: Set up Git + run: | + git config --global user.name "${{ secrets.GITLAB_USER }}" + git config --global user.email "${{ secrets.GITLAB_EMAIL }}" + env: + GITLAB_USER: ${{ secrets.GITLAB_USER }} + GITLAB_EMAIL: ${{ secrets.GITLAB_EMAIL }} + + - name: Remove shallow update + run: git fetch --prune --unshallow + + - name: Push to GitLab + run: | + git remote add gitlab https://oauth2:${{ secrets.GITLAB_TOKEN }}@gitlab.com/rmottanet/${{ steps.extract_repo_name.outputs.reponame }}.git + git push --set-upstream gitlab --all + git push --set-upstream gitlab --tags + env: + GITLAB_TOKEN: ${{ secrets.GITLAB_TOKEN }} diff --git a/.github/workflows/mirror.yml b/.github/workflows/mirror.yml new file mode 100644 index 0000000..c044775 --- /dev/null +++ b/.github/workflows/mirror.yml @@ -0,0 +1,32 @@ +name: Mirror + +on: + pull_request: + types: [closed] + branches: [ "main" ] + +jobs: + sync_to_gitlab: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Extract repository name + id: extract_repo_name + run: echo "::set-output name=reponame::$(echo $GITHUB_REPOSITORY | cut -d'/' -f2)" + + - name: Set up Git + run: | + git config --global user.name "${{ secrets.GITLAB_USER }}" + git config --global user.email "${{ secrets.GITLAB_EMAIL }}" + + - name: Sync to GitLab + run: | + git remote add gitlab https://oauth2:${{ secrets.GITLAB_TOKEN }}@gitlab.com/rmottanet/${{ steps.extract_repo_name.outputs.reponame }}.git + git fetch --prune --unshallow + git checkout main + git merge --allow-unrelated-histories -X theirs --no-edit origin/main + git push gitlab main + env: + GITLAB_TOKEN: ${{ secrets.GITLAB_TOKEN }} diff --git a/.gitignore b/.gitignore index aaf23bc..4c49bd7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1 @@ -./python/.env/* -./cpp/bin/* - +.env diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..3e9b785 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,14 @@ +# Mirroring on Github + +stages: + - mirror + +mirror: + stage: mirror + script: + - export REPO_NAME=$(echo $CI_PROJECT_PATH | cut -d'/' -f2) + - git remote add github https://${GITHUB_TOKEN}@github.com/rmottanet/$REPO_NAME.git + - git checkout -b main + - git push --set-upstream github main + rules: + - if: '$CI_PIPELINE_SOURCE == "merge_request" && $CI_MERGE_REQUEST_EVENT_TYPE == "close"' diff --git a/README.md b/README.md index 827fa4b..b10422f 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ Pong Study Repository: A Linguistic Exploration. A repository dedicated to the meticulous examination of the classic game Pong. -Hey there, fellow game enthusiasts! Welcome to my personal exploration of the classic Pong game, but with a quirky twist – I call it [PongCraft](https://github.com/PongCraft) Adventures! +Hey there, fellow game enthusiasts! Welcome to my personal exploration of the classic [Pong](https://rmottanet.github.io/pongtopia/) game, but with a quirky twist – I call it [PongCraft](https://github.com/PongCraft) Adventures! Dive into the PongCraft world in various programming languages like Python, MIT Scratch, JavaScript, and Java. If you're curious and ready to embark on this solo coding journey with me, check out the different versions in my repository PongCraft. Each language brings its unique flavor to the game, allowing me to unravel the mysteries of code one paddle swing at a time. @@ -10,4 +10,18 @@ Curious about different languages? Check out [PongCraft](https://github.com/Pong Legal Stuff – Legalities are covered under the MIT License. Refer to the documentation for details. -Got questions or suggestions? Let's chat. Explore Pong across diverse languages in the [PongCraft](https://github.com/PongCraft) domain. +--- + +Got questions or suggestions? Let's chat. Explore Pong across diverse languages in the [PongCraft](https://github.com/PongCraft) domain. + +Thank you for visiting [Pongtopia!](https://rmottanet.github.io/pongtopia/) If you have any questions, issues, or suggestions, please don't hesitate to reach out. Happy gaming! 🎮 + +
+
+

+GitLab +GitHub +Instagram +Linkedin +

+