41 lines
1.3 KiB
YAML
41 lines
1.3 KiB
YAML
name: Sync selected files to GitHub
|
|
|
|
on:
|
|
push:
|
|
branches: [ main ]
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
sync:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Clone destination (GitHub)
|
|
run: |
|
|
git clone https://x-access-token:${{ secrets.GH_TOKEN }}@github.com/natxocc/sigpro.git dest
|
|
cd dest
|
|
git config user.name "Sync Bot"
|
|
git config user.email "bot@natxocc.com"
|
|
|
|
- name: Copy files from local volume
|
|
run: |
|
|
SOURCE_DIR="/volume1/webdocs/sigpro"
|
|
if [ ! -d "$SOURCE_DIR" ]; then
|
|
echo "Source directory not found at $SOURCE_DIR"
|
|
exit 1
|
|
fi
|
|
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
|
|
if [ -f "$SOURCE_DIR/$file" ]; then
|
|
mkdir -p "dest/$(dirname $file)"
|
|
cp "$SOURCE_DIR/$file" "dest/$file"
|
|
echo "Copied $file"
|
|
else
|
|
echo "Warning: $SOURCE_DIR/$file not found"
|
|
fi
|
|
done
|
|
|
|
- name: Commit and push
|
|
run: |
|
|
cd dest
|
|
git add .
|
|
git diff --staged --quiet || (git commit -m "Sync selected files from local volume [skip ci]" && git push origin main) |