Files
voculinux/.github/workflows/codeberg-mirror.yml
T
fe9584e21e fix(ci): force-push tags in Codeberg mirror workflow (#633)
git push --tags fails when a tag already exists on Codeberg (e.g.
v0.15.0 from a prior sync or retag). GitHub is the source of truth for
this read-only mirror, so force-push tags to keep them aligned.

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Jatin K Malik <jatinkrmalik@users.noreply.github.com>
2026-08-02 21:10:36 -07:00

46 lines
1.4 KiB
YAML

# Push git data to the Codeberg read-only mirror after changes land on main.
name: Mirror to Codeberg
on:
push:
branches: [main]
tags: ['v*']
workflow_dispatch:
concurrency:
group: codeberg-mirror
cancel-in-progress: true
jobs:
mirror:
name: Push to Codeberg
runs-on: ubuntu-latest
if: github.repository == 'jatinkrmalik/vocalinux'
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Mirror branches and tags to Codeberg
env:
SSH_PRIVATE_KEY: ${{ secrets.CODEBERG_MIRROR_SSH_KEY }}
run: |
set -euo pipefail
if [ -z "${SSH_PRIVATE_KEY}" ]; then
echo "CODEBERG_MIRROR_SSH_KEY is not set; skipping mirror push."
exit 0
fi
install -m 700 -d ~/.ssh
printf '%s\n' "$SSH_PRIVATE_KEY" > ~/.ssh/codeberg_mirror
chmod 600 ~/.ssh/codeberg_mirror
ssh-keyscan -t ed25519,rsa codeberg.org >> ~/.ssh/known_hosts 2>/dev/null || true
export GIT_SSH_COMMAND="ssh -i ~/.ssh/codeberg_mirror -o IdentitiesOnly=yes"
git remote add codeberg git@codeberg.org:jatinkrmalik/vocalinux.git
git push codeberg --all
# Force tags so the mirror stays aligned with GitHub when a tag
# already exists on Codeberg (retagged release or prior partial sync).
git push codeberg --tags --force