projects

showcase

A public git mirror

fix: actually commit mirror.yaml

daniel daum committed parent 1870611 commit a863394

Showing 1 changed file with 44 additions and 0 deletions.

.gitea/workflows/mirror.yaml +44 −0
@@ -0,0 +1,44 @@1# mirrors main to github and tangled on every push. gitea is the source of2# truth, so both get force-pushed to match it. the same file works in every3# repo: it pushes to the repo with the same name on github and tangled.4# needs the GH_MIRROR_TOKEN and TANGLED_MIRROR_KEY secrets, and the5# TANGLED_KNOWN_HOSTS variable (ssh-keyscan tangled.org, checked once)6name: Mirror78on:9    push:10        branches:11            - main12    workflow_dispatch:1314jobs:15    mirror:16        runs-on: ubuntu-latest17        env:18            REPO: ${{ github.event.repository.name }}19        steps:20            # full history, and origin/main is the newest main, so a late or21            # retried run never rolls the mirrors back22            - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.023              with:24                  fetch-depth: 02526            - name: Mirror to GitHub27              env:28                  TOKEN: ${{ secrets.GH_MIRROR_TOKEN }}29              run: |30                  set -euo pipefail31                  git push --force "https://x-access-token:${TOKEN}@github.com/daniel-daum/${REPO}.git" refs/remotes/origin/main:refs/heads/main3233            - name: Mirror to Tangled34              env:35                  KEY: ${{ secrets.TANGLED_MIRROR_KEY }}36                  KNOWN_HOSTS: ${{ vars.TANGLED_KNOWN_HOSTS }}37              run: |38                  set -euo pipefail39                  mkdir -p ~/.ssh40                  printf '%s\n' "$KEY" > ~/.ssh/tangled41                  chmod 600 ~/.ssh/tangled42                  printf '%s\n' "$KNOWN_HOSTS" > ~/.ssh/known_hosts43                  export GIT_SSH_COMMAND="ssh -i ~/.ssh/tangled -o IdentitiesOnly=yes -o StrictHostKeyChecking=yes"44                  git push --force "daum.dev@tangled.org:daum.dev/${REPO}" refs/remotes/origin/main:refs/heads/main