File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name: Mirror to GitLab and Bitbucket
2+
3+ on:
4+ push:
5+ branches: [main, master]
6+ tags:
7+ - 'v*'
8+ workflow_dispatch:
9+
10+ jobs:
11+ mirror-gitlab:
12+ runs-on: ubuntu-latest
13+ if: ${{ vars.GITLAB_MIRROR_ENABLED == 'true' }}
14+
15+ steps:
16+ - name: Checkout
17+ uses: actions/checkout@v4
18+ with:
19+ fetch-depth: 0
20+
21+ - name: Push to GitLab
22+ env:
23+ GITLAB_TOKEN: ${{ secrets.GITLAB_TOKEN }}
24+ REPO_NAME: ${{ github.event.repository.name }}
25+ run: |
26+ git remote add gitlab https://oauth2:${GITLAB_TOKEN}@gitlab.com/hyperpolymath/${REPO_NAME}.git || true
27+ git push gitlab HEAD:main --force || git push gitlab HEAD:master --force
28+ git push gitlab --tags --force
29+
30+ mirror-bitbucket:
31+ runs-on: ubuntu-latest
32+ if: ${{ vars.BITBUCKET_MIRROR_ENABLED == 'true' }}
33+
34+ steps:
35+ - name: Checkout
36+ uses: actions/checkout@v4
37+ with:
38+ fetch-depth: 0
39+
40+ - name: Push to Bitbucket
41+ env:
42+ BITBUCKET_TOKEN: ${{ secrets.BITBUCKET_TOKEN }}
43+ REPO_NAME: ${{ github.event.repository.name }}
44+ run: |
45+ git remote add bitbucket https://x-token-auth:${BITBUCKET_TOKEN}@bitbucket.org/hyperpolymath/${REPO_NAME}.git || true
46+ git push bitbucket HEAD:main --force || git push bitbucket HEAD:master --force
47+ git push bitbucket --tags --force
You can’t perform that action at this time.
0 commit comments