ci: sync changed main files to Google Drive
Sync changed files to Google Drive / sync (push) Successful in 34s
Sync changed files to Google Drive / sync (push) Successful in 34s
This commit is contained in:
1 parent
a92ba72b76
commit
5870d0ce41
1 file changed
+32
@@ -0,0 +1,32 @@
|
|||||||
|
name: Sync changed files to Google Drive
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
sync:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Upload changed files
|
||||||
|
env:
|
||||||
|
BEFORE: ${{ gitea.event.before }}
|
||||||
|
AFTER: ${{ gitea.event.after }}
|
||||||
|
RCLONE_CONFIG_GDRIVE: ${{ secrets.RCLONE_CONFIG_GDRIVE }}
|
||||||
|
run: |
|
||||||
|
curl -fsSL https://rclone.org/install.sh | sudo bash
|
||||||
|
config=$(mktemp)
|
||||||
|
trap 'rm -f "$config"' EXIT
|
||||||
|
printf '%s' "$RCLONE_CONFIG_GDRIVE" > "$config"
|
||||||
|
if test "${BEFORE//0/}"; then
|
||||||
|
git diff --name-only --diff-filter=ACMRT -z "$BEFORE" "$AFTER"
|
||||||
|
else
|
||||||
|
git ls-files -z
|
||||||
|
fi | while IFS= read -r -d '' file; do
|
||||||
|
case "$file" in build|build/*) continue ;; esac
|
||||||
|
rclone copyto --config "$config" "$file" "gdrive:$file"
|
||||||
|
done
|
||||||
Reference in new issue
Block a user