rheaarchived
- 40 commits
- 1 branch
- 0 tags
- updated
fix: migrate to tangled
SignedGitea couldn't verify the signature.
Showing 2 changed files with 28 additions and 59 deletions.
.gitea/workflows/mirror.yamldeleted
+0 −59
@@ -1,59 +0,0 @@1name: mirror2on:3 push:4 branches: [main]5 workflow_dispatch:67env:8 TANGLED_SSH_PORT: "2222"9 TANGLED_REMOTE: "ssh://git@knot.danieldaum.net:2222/danieldaum.net/rhea"1011jobs:12 mirror:13 runs-on: ubuntu-latest14 steps:15 - name: Checkout16 uses: actions/checkout@v417 with:18 fetch-depth: 01920 - name: Push to GitHub21 run: |22 git remote add github https://x-access-token:${{ secrets.GH_MIRROR_TOKEN }}@github.com/daniel-daum/rhea.git23 git push github main --force24 git push github --tags --force2526 - name: Set up SSH for Tangled27 env:28 TANGLED_SSH_KEY: ${{ secrets.TANGLED_SSH_KEY }}29 # Public half of the deploy key registered on Tangled as "gitea-ci-mirror".30 EXPECTED_PUBKEY: ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDNl8WEwlLHsqWi15NNoZCqkDG2/GjiGgthdIYVm8kNM31 run: |32 mkdir -p ~/.ssh && chmod 700 ~/.ssh33 if [ -z "$TANGLED_SSH_KEY" ]; then34 echo "::error::secret TANGLED_SSH_KEY is empty or not visible to this workflow"35 exit 136 fi37 # Strip CRs (pasted from Windows/clipboard) and guarantee a trailing newline.38 printf '%s\n' "$TANGLED_SSH_KEY" | tr -d '\r' > ~/.ssh/tangled_ci39 chmod 600 ~/.ssh/tangled_ci40 echo "key file: $(wc -l < ~/.ssh/tangled_ci) lines, first line: $(head -n1 ~/.ssh/tangled_ci)"41 # Derive the public key; this fails loudly if the private key is malformed.42 if ! actual=$(ssh-keygen -y -f ~/.ssh/tangled_ci); then43 echo "::error::TANGLED_SSH_KEY is not a valid private key (check it is the PRIVATE key, all lines intact)"44 exit 145 fi46 echo "derived pubkey: $actual"47 if [ "$(echo "$actual" | cut -d' ' -f1,2)" != "$EXPECTED_PUBKEY" ]; then48 echo "::error::TANGLED_SSH_KEY does not match the gitea-ci-mirror key registered on Tangled"49 exit 150 fi51 ssh-keyscan -t ed25519 -p "$TANGLED_SSH_PORT" knot.danieldaum.net >> ~/.ssh/known_hosts5253 - name: Push to Tangled54 env:55 GIT_SSH_COMMAND: ssh -i ~/.ssh/tangled_ci -o IdentitiesOnly=yes -o UserKnownHostsFile=~/.ssh/known_hosts56 run: |57 git remote add tangled "$TANGLED_REMOTE"58 git push tangled main --force59 git push tangled --tags --force
.tangled/workflows/mirror.yamladded
+28 −0
@@ -0,0 +1,28 @@1# mirrors main to github and gitea on every push. tangled is the source of2# truth, so both get force-pushed to match it. needs the GH_MIRROR_TOKEN and3# GITEA_MIRROR_TOKEN secrets45when:6 - event: ["push", "manual"]7 branch: ["main"]89engine: "nixery"1011steps:12 # spindle clones one commit deep (depth: 0 means 1 too), and the mirrors13 # need the whole history. this also points origin/main at the newest main,14 # so a late or retried run never rolls the mirrors back15 - name: "Fetch full history"16 command: |17 set -euo pipefail18 git fetch --unshallow origin1920 - name: "Mirror to GitHub"21 command: |22 set -euo pipefail23 git push --force "https://x-access-token:${GH_MIRROR_TOKEN}@github.com/daniel-daum/rhea.git" refs/remotes/origin/main:refs/heads/main2425 - name: "Mirror to Gitea"26 command: |27 set -euo pipefail28 git push --force "https://daniel-daum:${GITEA_MIRROR_TOKEN}@git.danieldaum.net/daniel-daum/rhea.git" refs/remotes/origin/main:refs/heads/main