Actualizar .github/workflows/sync-to-github.yml
Some checks failed
Sync selected files to GitHub / sync (push) Has been cancelled
Some checks failed
Sync selected files to GitHub / sync (push) Has been cancelled
This commit is contained in:
41
.github/workflows/sync-to-github.yml
vendored
41
.github/workflows/sync-to-github.yml
vendored
@@ -2,54 +2,45 @@ name: Sync selected files to GitHub
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ main, master ]
|
branches: [ main ]
|
||||||
workflow_dispatch: # permite ejecución manual
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
sync:
|
sync:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout source (Gitea)
|
# 1️⃣ Clonar origen (Gitea) usando dominio externo
|
||||||
uses: actions/checkout@v4
|
- name: Clone source from Gitea
|
||||||
with:
|
run: |
|
||||||
path: source
|
git clone https://git.natxocc.com/natxocc/sigpro.git source
|
||||||
|
cd source
|
||||||
|
git checkout main # o la rama que necesites
|
||||||
|
|
||||||
|
# 2️⃣ Clonar destino (GitHub) igual que antes
|
||||||
- name: Clone destination (GitHub)
|
- name: Clone destination (GitHub)
|
||||||
run: |
|
run: |
|
||||||
git clone https://x-access-token:${{ secrets.GH_TOKEN }}@github.com/natxocc/sigpro.git dest
|
git clone https://x-access-token:${{ secrets.GH_TOKEN }}@github.com/natxocc/sigpro.git dest
|
||||||
cd dest
|
cd dest
|
||||||
git config user.name "Gitea Sync Bot"
|
git config user.name "Sync Bot"
|
||||||
git config user.email "bot@natxocc.com"
|
git config user.email "bot@natxocc.com"
|
||||||
|
|
||||||
|
# 3️⃣ Copiar archivos seleccionados
|
||||||
- name: Copy selected files
|
- name: Copy selected files
|
||||||
run: |
|
run: |
|
||||||
# Lista de archivos (rutas relativas desde la raíz del repositorio)
|
FILES="sigpro.js sigpro.d.ts vite/index.js dist/sigpro.esm.js dist/sigpro.esm.min.js dist/sigpro.js dist/sigpro.min.js"
|
||||||
FILES="
|
|
||||||
sigpro.js
|
|
||||||
sigpro.d.ts
|
|
||||||
vite/index.js
|
|
||||||
dist/sigpro.esm.js
|
|
||||||
dist/sigpro.esm.min.js
|
|
||||||
dist/sigpro.js
|
|
||||||
dist/sigpro.min.js
|
|
||||||
"
|
|
||||||
for file in $FILES; do
|
for file in $FILES; do
|
||||||
if [ -f "source/$file" ]; then
|
if [ -f "source/$file" ]; then
|
||||||
mkdir -p "dest/$(dirname $file)"
|
mkdir -p "dest/$(dirname $file)"
|
||||||
cp "source/$file" "dest/$file"
|
cp "source/$file" "dest/$file"
|
||||||
echo "Copied $file"
|
echo "Copied $file"
|
||||||
else
|
else
|
||||||
echo "Warning: source/$file not found, skipping"
|
echo "Warning: source/$file not found"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
- name: Commit and push changes
|
# 4️⃣ Commit y push a GitHub
|
||||||
|
- name: Commit and push
|
||||||
run: |
|
run: |
|
||||||
cd dest
|
cd dest
|
||||||
git add .
|
git add .
|
||||||
if git diff --staged --quiet; then
|
git diff --staged --quiet || (git commit -m "Sync selected files from Gitea [skip ci]" && git push origin main)
|
||||||
echo "No changes to sync"
|
|
||||||
else
|
|
||||||
git commit -m "Sync selected files from Gitea [skip ci]"
|
|
||||||
git push origin main
|
|
||||||
fi
|
|
||||||
Reference in New Issue
Block a user