projects

minerva

Personal learning

feat: add git mirror workflow

daniel daum committed commit 11b931cSigned, not verified

SignedGitea couldn't verify the signature.

Showing 1 changed file with 39 additions and 0 deletions.

.gitea/workflows/mirror.yamladded +39 −0
@@ -0,0 +1,39 @@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 secrets5name: Mirror67on:8    push:9        branches:10            - main11    workflow_dispatch:1213jobs:14    mirror:15        runs-on: ubuntu-latest16        env:17            REPO: ${{ github.event.repository.name }}18        steps:19            # full history, and origin/main is the newest main, so a late or20            # retried run never rolls the mirrors back21            - name: Checkout22              uses: actions/checkout@v423              with:24                  fetch-depth: 02526            - name: Mirror to GitHub27              run: |28                  set -euo pipefail29                  git push --force "https://x-access-token:${{ secrets.GH_MIRROR_TOKEN }}@github.com/daniel-daum/${REPO}.git" refs/remotes/origin/main:refs/heads/main3031            - name: Mirror to Tangled32              run: |33                  set -euo pipefail34                  mkdir -p ~/.ssh35                  printf '%s\n' "${{ secrets.TANGLED_MIRROR_KEY }}" > ~/.ssh/tangled36                  chmod 600 ~/.ssh/tangled37                  ssh-keyscan tangled.org >> ~/.ssh/known_hosts38                  export GIT_SSH_COMMAND="ssh -i ~/.ssh/tangled -o IdentitiesOnly=yes"39                  git push --force "git@tangled.org:danieldaum.net/${REPO}" refs/remotes/origin/main:refs/heads/main