-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/Ext1nguisher/WikiHomepage-PCL
- Loading branch information
Showing
1 changed file
with
52 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
name: Sync to Alist via WebDAV | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
schedule: | ||
- cron: 0 1 * * * | ||
|
||
jobs: | ||
sync_to_alist: | ||
runs-on: ubuntu-latest | ||
steps: | ||
# Checkout repository | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
# Install rclone | ||
- name: Install rclone | ||
run: | | ||
curl https://rclone.org/install.sh | sudo bash | ||
# Configure rclone for WebDAV | ||
- name: Configure rclone for WebDAV | ||
run: | | ||
rclone config create alist_webdav webdav \ | ||
url http://${{ secrets.WEBDAV_HOST }}:${{ secrets.WEBDAV_PORT }}/dav \ | ||
user ${{ secrets.ALIST_USERNAME }} \ | ||
pass ${{ secrets.ALIST_PASSWORD }} | ||
# Check current working directory (debugging step) | ||
- name: Print current working directory | ||
run: | | ||
pwd | ||
ls -al | ||
# Clear the target folder on Alist WebDAV | ||
- name: Clear target folder on Alist WebDAV | ||
run: | | ||
rclone delete alist_webdav:/ --rmdirs # Deletes all files and empty directories from the target folder | ||
# Sync all files to Alist WebDAV (sync the entire repo) | ||
- name: Sync all files to Alist | ||
run: | | ||
rclone copy ./ alist_webdav:/ --checksum --size-only --retries 3 # Force update every time | ||
# Optionally, clean up rclone configuration (for security) | ||
- name: Clean up rclone config | ||
run: rm -rf ~/.config/rclone |