Actualizar .github/workflows/sync-to-github.yml
This commit is contained in:
38
.github/workflows/sync-to-github.yml
vendored
38
.github/workflows/sync-to-github.yml
vendored
@@ -1,29 +1,28 @@
|
|||||||
name: Sync selected files to GitHub
|
name: Sync selected files to GitHub
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
|
||||||
branches: [ main ]
|
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
sync:
|
sync:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
container:
|
||||||
- name: Debug mounted volumes
|
image: node:20-bullseye
|
||||||
run: |
|
options: >-
|
||||||
ls -la /
|
--dns 192.168.1.1
|
||||||
echo "---"
|
--add-host git.natxocc.com:host-gateway
|
||||||
ls -la /repo.git 2>&1 || echo "Not found"
|
--add-host gitea:host-gateway
|
||||||
echo "---"
|
|
||||||
find / -name "sigpro.git" 2>/dev/null || echo "No sigpro.git found"
|
|
||||||
- name: Clone source from local bare repo
|
|
||||||
run: |
|
|
||||||
git clone --local /repo.git source
|
|
||||||
cd source
|
|
||||||
git checkout main
|
|
||||||
ls -la
|
|
||||||
|
|
||||||
- name: Clone destination (GitHub)
|
steps:
|
||||||
|
- name: Checkout source from Gitea
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 1
|
||||||
|
path: source
|
||||||
|
env:
|
||||||
|
GIT_CONFIG_PARAMETERS: url.https://git.natxocc.com/.insteadOf=http://gitea:3000/
|
||||||
|
|
||||||
|
- name: Checkout destination from 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
|
||||||
@@ -37,9 +36,6 @@ jobs:
|
|||||||
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"
|
|
||||||
else
|
|
||||||
echo "Warning: source/$file not found"
|
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
@@ -47,4 +43,4 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
cd dest
|
cd dest
|
||||||
git add .
|
git add .
|
||||||
git diff --staged --quiet || (git commit -m "Sync selected files from Gitea [skip ci]" && git push origin main)
|
git diff --staged --quiet || (git commit -m "Sync selected files from Gitea" && git push origin main)
|
||||||
Reference in New Issue
Block a user