diff --git a/.github/workflows/mirror.yml b/.github/workflows/mirror.yml index 7681024..2083ca6 100644 --- a/.github/workflows/mirror.yml +++ b/.github/workflows/mirror.yml @@ -1,73 +1,15 @@ # SPDX-License-Identifier: MPL-2.0 -name: Mirror to GitLab and Bitbucket +name: Mirror to Git Forges on: push: - branches: [main, master] - tags: - - 'v*' + branches: [main] workflow_dispatch: permissions: contents: read jobs: - mirror-gitlab: - runs-on: ubuntu-latest - permissions: - contents: read - if: ${{ vars.GITLAB_MIRROR_ENABLED == 'true' }} - - steps: - - name: Checkout - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 - with: - fetch-depth: 0 - - - name: Setup SSH - uses: webfactory/ssh-agent@a6f90b1f127823b31d4d4a8d96047790581349bd # v0.9.1 - with: - ssh-private-key: ${{ secrets.GITLAB_SSH_KEY }} - - - name: Add GitLab to known hosts - run: | - mkdir -p ~/.ssh - ssh-keyscan -t ed25519 gitlab.com >> ~/.ssh/known_hosts - - - name: Push to GitLab - env: - REPO_NAME: ${{ github.event.repository.name }} - run: | - git remote add gitlab git@gitlab.com:hyperpolymath/${REPO_NAME}.git || true - git push gitlab HEAD:main --force || git push gitlab HEAD:master --force - git push gitlab --tags --force - - mirror-bitbucket: - runs-on: ubuntu-latest - permissions: - contents: read - if: ${{ vars.BITBUCKET_MIRROR_ENABLED == 'true' }} - - steps: - - name: Checkout - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 - with: - fetch-depth: 0 - - - name: Setup SSH - uses: webfactory/ssh-agent@a6f90b1f127823b31d4d4a8d96047790581349bd # v0.9.1 - with: - ssh-private-key: ${{ secrets.BITBUCKET_SSH_KEY }} - - - name: Add Bitbucket to known hosts - run: | - mkdir -p ~/.ssh - ssh-keyscan -t ed25519 bitbucket.org >> ~/.ssh/known_hosts - - - name: Push to Bitbucket - env: - REPO_NAME: ${{ github.event.repository.name }} - run: | - git remote add bitbucket git@bitbucket.org:hyperpolymath/${REPO_NAME}.git || true - git push bitbucket HEAD:main --force || git push bitbucket HEAD:master --force - git push bitbucket --tags --force + mirror: + uses: hyperpolymath/standards/.github/workflows/mirror-reusable.yml@e6b2884722350515934d443daf23442f2195796f + secrets: inherit