|
1 | 1 | # SPDX-License-Identifier: MPL-2.0 |
2 | | -name: Mirror to GitLab and Bitbucket |
| 2 | +name: Mirror to Git Forges |
3 | 3 |
|
4 | 4 | on: |
5 | 5 | push: |
6 | | - branches: [main, master] |
7 | | - tags: |
8 | | - - 'v*' |
| 6 | + branches: [main] |
9 | 7 | workflow_dispatch: |
10 | 8 |
|
11 | 9 | permissions: |
12 | 10 | contents: read |
13 | 11 |
|
14 | 12 | jobs: |
15 | | - mirror-gitlab: |
16 | | - runs-on: ubuntu-latest |
17 | | - permissions: |
18 | | - contents: read |
19 | | - if: ${{ vars.GITLAB_MIRROR_ENABLED == 'true' }} |
20 | | - |
21 | | - steps: |
22 | | - - name: Checkout |
23 | | - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 |
24 | | - with: |
25 | | - fetch-depth: 0 |
26 | | - |
27 | | - - name: Setup SSH |
28 | | - uses: webfactory/ssh-agent@a6f90b1f127823b31d4d4a8d96047790581349bd # v0.9.1 |
29 | | - with: |
30 | | - ssh-private-key: ${{ secrets.GITLAB_SSH_KEY }} |
31 | | - |
32 | | - - name: Add GitLab to known hosts |
33 | | - run: | |
34 | | - mkdir -p ~/.ssh |
35 | | - ssh-keyscan -t ed25519 gitlab.com >> ~/.ssh/known_hosts |
36 | | -
|
37 | | - - name: Push to GitLab |
38 | | - env: |
39 | | - REPO_NAME: ${{ github.event.repository.name }} |
40 | | - run: | |
41 | | - git remote add gitlab git@gitlab.com:hyperpolymath/${REPO_NAME}.git || true |
42 | | - git push gitlab HEAD:main --force || git push gitlab HEAD:master --force |
43 | | - git push gitlab --tags --force |
44 | | -
|
45 | | - mirror-bitbucket: |
46 | | - runs-on: ubuntu-latest |
47 | | - permissions: |
48 | | - contents: read |
49 | | - if: ${{ vars.BITBUCKET_MIRROR_ENABLED == 'true' }} |
50 | | - |
51 | | - steps: |
52 | | - - name: Checkout |
53 | | - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 |
54 | | - with: |
55 | | - fetch-depth: 0 |
56 | | - |
57 | | - - name: Setup SSH |
58 | | - uses: webfactory/ssh-agent@a6f90b1f127823b31d4d4a8d96047790581349bd # v0.9.1 |
59 | | - with: |
60 | | - ssh-private-key: ${{ secrets.BITBUCKET_SSH_KEY }} |
61 | | - |
62 | | - - name: Add Bitbucket to known hosts |
63 | | - run: | |
64 | | - mkdir -p ~/.ssh |
65 | | - ssh-keyscan -t ed25519 bitbucket.org >> ~/.ssh/known_hosts |
66 | | -
|
67 | | - - name: Push to Bitbucket |
68 | | - env: |
69 | | - REPO_NAME: ${{ github.event.repository.name }} |
70 | | - run: | |
71 | | - git remote add bitbucket git@bitbucket.org:hyperpolymath/${REPO_NAME}.git || true |
72 | | - git push bitbucket HEAD:main --force || git push bitbucket HEAD:master --force |
73 | | - git push bitbucket --tags --force |
| 13 | + mirror: |
| 14 | + uses: hyperpolymath/standards/.github/workflows/mirror-reusable.yml@e6b2884722350515934d443daf23442f2195796f |
| 15 | + secrets: inherit |
0 commit comments