This commit is contained in:
@@ -1,19 +1,27 @@
|
|||||||
name: Sync public mirror
|
name: Diagnose SSH to Flux-oss
|
||||||
on:
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
push:
|
push:
|
||||||
branches: [ main ] # change if your default branch differs
|
branches: [ main ]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
sync:
|
diag:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout private repo
|
- name: Print runner info
|
||||||
uses: actions/checkout@v4
|
run: |
|
||||||
with:
|
uname -a
|
||||||
fetch-depth: 0
|
df -h
|
||||||
|
free -h || true
|
||||||
|
|
||||||
- name: Install rsync
|
- name: Ensure secret is present
|
||||||
run: sudo apt-get update && sudo apt-get install -y rsync
|
env:
|
||||||
|
SSH_KEY: ${{ secrets.PUBLIC_REPO_SSH_KEY }}
|
||||||
|
run: |
|
||||||
|
if [ -z "$SSH_KEY" ]; then
|
||||||
|
echo "Secret PUBLIC_REPO_SSH_KEY is missing"; exit 1
|
||||||
|
fi
|
||||||
|
echo "Secret length: ${#SSH_KEY}"
|
||||||
|
|
||||||
- name: Prepare SSH
|
- name: Prepare SSH
|
||||||
env:
|
env:
|
||||||
@@ -23,25 +31,13 @@ jobs:
|
|||||||
mkdir -p ~/.ssh
|
mkdir -p ~/.ssh
|
||||||
echo "$SSH_KEY" > ~/.ssh/id_sync
|
echo "$SSH_KEY" > ~/.ssh/id_sync
|
||||||
chmod 600 ~/.ssh/id_sync
|
chmod 600 ~/.ssh/id_sync
|
||||||
printf 'Host 192.168.1.15\n HostName 192.168.1.15\n Port 22\n User git\n IdentityFile ~/.ssh/id_sync\n IdentitiesOnly yes\n' >> ~/.ssh/config
|
printf 'Host gitea-lan\n HostName 192.168.1.15\n Port 22\n User git\n IdentityFile ~/.ssh/id_sync\n IdentitiesOnly yes\n' >> ~/.ssh/config
|
||||||
ssh-keyscan -p 22 192.168.1.15 >> ~/.ssh/known_hosts
|
ssh-keyscan -p 22 192.168.1.15 >> ~/.ssh/known_hosts
|
||||||
|
|
||||||
- name: Clone public repo
|
- name: Test SSH auth to server
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
ssh -T gitea-lan || true
|
||||||
git clone --depth 1 "ssh://git@192.168.1.15:22/Bausager/Flux-oss.git" /tmp/public
|
|
||||||
|
|
||||||
- name: Sync files (snapshot)
|
- name: Test Git access to Flux-oss
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
git ls-remote ssh://gitea-lan/Bausager/Flux-oss.git
|
||||||
rsync -a --delete --exclude '.git' --exclude '.gitea' ./ /tmp/public/
|
|
||||||
cd /tmp/public
|
|
||||||
git config user.name "Gitea CI"
|
|
||||||
git config user.email "ci@bausager.org"
|
|
||||||
if ! git diff --quiet; then
|
|
||||||
git add -A
|
|
||||||
git commit -m "Sync from Flux (private)"
|
|
||||||
git push origin HEAD:main
|
|
||||||
else
|
|
||||||
echo "No changes to push."
|
|
||||||
fi
|
|
||||||
|
|||||||
Reference in New Issue
Block a user