gitlab_mirror.yml (1385B)
1 # Copyright (c) the JPEG XL Project Authors. All rights reserved. 2 # 3 # Use of this source code is governed by a BSD-style 4 # license that can be found in the LICENSE file. 5 6 # Workflow for building and running tests. 7 8 name: Mirror to GitLab 9 10 on: 11 push: 12 branches: 13 - main 14 - v*.*.x 15 16 env: 17 BRANCH_NAME: ${{ github.head_ref || github.ref_name }} 18 19 permissions: 20 contents: read 21 22 jobs: 23 mirror: 24 permissions: 25 contents: write # for Git to git push 26 if: github.repository_owner == 'libjxl' 27 runs-on: ubuntu-latest 28 29 steps: 30 - name: Harden Runner 31 uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0 32 with: 33 egress-policy: audit 34 35 - name: Checkout source 36 uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 37 with: 38 fetch-depth: 0 # Disable shallow clone 39 40 - name: Set up SSH 41 run: | 42 mkdir -p ~/.ssh/ 43 chmod 700 ~/.ssh/ 44 echo "${{ secrets.GITLAB_DEPLOY_KEY }}" > ~/.ssh/id_ed25519 45 chmod 400 ~/.ssh/id_ed25519 46 ssh-keyscan gitlab.com >> ~/.ssh/known_hosts 47 48 - name: Push to GitLab 49 env: 50 GIT_SSH_COMMAND: ssh -v -i ~/.ssh/id_ed25519 -o IdentitiesOnly=yes -o StrictHostKeyChecking=no 51 run: | 52 git remote add gitlab git@gitlab.com:wg1/jpeg-xl.git 53 git push gitlab $BRANCH_NAME:$BRANCH_NAME