diff --git a/.gitea/workflows/sync-google-drive.yml b/.gitea/workflows/sync-google-drive.yml new file mode 100644 index 0000000..3e0d5aa --- /dev/null +++ b/.gitea/workflows/sync-google-drive.yml @@ -0,0 +1,35 @@ +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 }} + GDRIVE_FOLDER_ID: ${{ vars.GDRIVE_FOLDER_ID }} + GDRIVE_SERVICE_ACCOUNT_JSON: ${{ secrets.GDRIVE_SERVICE_ACCOUNT_JSON }} + run: | + curl -fsSL https://rclone.org/install.sh | sudo bash + key=$(mktemp) + config=$(mktemp) + trap 'rm -f "$key" "$config"' EXIT + printf '%s' "$GDRIVE_SERVICE_ACCOUNT_JSON" > "$key" + printf '[gdrive]\ntype = drive\nscope = drive\nroot_folder_id = %s\nservice_account_file = %s\n' "$GDRIVE_FOLDER_ID" "$key" > "$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 diff --git a/.gitignore b/.gitignore index 8ebf5e8..84c048a 100755 --- a/.gitignore +++ b/.gitignore @@ -1,20 +1 @@ -# Source-only repository: never commit generated outputs or external assets. -/vendor/ -/private-assets/ /build/ -/dist/ -/.cache/ -/reports/ -/docs/ -/assets/ -/data/ -/config/toolchain.lock.json -**/__pycache__/ -*.md -*.txt -*.sha256 -*.apk -*.so -*.a -*.ppu -*.o