Skip to content

Commit 1fb034b

Browse files
authored
Add GitHub Actions workflow for Codeberg mirroring
This workflow mirrors the repository to Codeberg on pushes to the main branch or when a new version tag is created.
1 parent 362d82c commit 1fb034b

1 file changed

Lines changed: 33 additions & 0 deletions

File tree

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: 🪞 Espelhamento para Codeberg
2+
3+
# Executa sempre que houver um push na main ou uma nova tag de versão for criada
4+
on:
5+
push:
6+
branches: [ main ]
7+
tags: [ 'v*' ]
8+
9+
jobs:
10+
mirror:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: 📥 Checkout do código
14+
uses: actions/checkout@v4
15+
with:
16+
fetch-depth: 0 # Fundamental: puxa todo o histórico, branches e tags
17+
18+
- name: 🚀 Sincronizando com o Codeberg
19+
env:
20+
CODEBERG_TOKEN: ${{ secrets.CODEBERG_TOKEN }}
21+
CODEBERG_USER: "vinicius3w" # ⚠️ Altere para o seu usuário/organização
22+
REPO_NAME: "bisolhador"
23+
run: |
24+
# Configura o git local para não reclamar de credenciais
25+
git config --global user.name "GitHub Action Mirror"
26+
git config --global user.email "action@github.com"
27+
28+
# Adiciona o Codeberg como um remote
29+
git remote add codeberg https://$CODEBERG_USER:$CODEBERG_TOKEN@codeberg.org/$CODEBERG_USER/$REPO_NAME.git
30+
31+
# Empurra todo o histórico e tags forçando a sincronia
32+
git push codeberg --all --force
33+
git push codeberg --tags --force

0 commit comments

Comments
 (0)