holonet
- 19 commits
- 1 branch
- 0 tags
- updated
ci: mirror to tangled and github
SignedGitea couldn't verify the signature.
Showing 1 changed file with 59 additions and 0 deletions.
.gitea/workflows/mirror.yamladded
+59 −0
@@ -0,0 +1,59 @@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/holonet"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/holonet.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