Skip to content

Commit

Permalink
Init Remotes
Browse files Browse the repository at this point in the history
  • Loading branch information
rmottanet committed Jan 2, 2024
1 parent c0daea8 commit 2f5ae9c
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/init_mirror_bitbucket.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Initialize Bitbucket mirror

on:
push:
branches:
- main

jobs:
sync_to_bitbucket:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- 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.email "${{ secrets.BITBUCKET_EMAIL }}"
env:
BITBUCKET_EMAIL: ${{ secrets.BITBUCKET_EMAIL }}

- name: Remove shallow update
run: git fetch --prune --unshallow

- name: Push to Bitbucket
run: |
git remote add bitbucket https://x-token-auth:${{ secrets.BITBUCKET_TOKEN }}@bitbucket.org/rmottalabs/${{ steps.extract_repo_name.outputs.reponame }}.git
git push --set-upstream bitbucket --all
git push --set-upstream bitbucket --tags
env:
BITBUCKET_TOKEN: ${{ secrets.BITBUCKET_TOKEN }}
36 changes: 36 additions & 0 deletions .github/workflows/init_mirror_gitlab.yml
Original file line number Diff line number Diff line change
@@ -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@v4

- 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 }}

0 comments on commit 2f5ae9c

Please sign in to comment.