diff --git a/create-db-and-upload-action/Dockerfile b/create-db-and-upload-action/Dockerfile index 73f9fda..0e16ca3 100644 --- a/create-db-and-upload-action/Dockerfile +++ b/create-db-and-upload-action/Dockerfile @@ -3,6 +3,6 @@ FROM archlinux:latest RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime RUN date RUN pacman -Syu --noconfirm -RUN pacman -S base-devel git python rclone pyalpm --noconfirm && sed -i '/E_ROOT/d' /usr/bin/makepkg +RUN pacman -S base-devel git python rclone pyalpm tree --noconfirm && sed -i '/E_ROOT/d' /usr/bin/makepkg COPY entrypoint.sh /entrypoint.sh ENTRYPOINT ["/entrypoint.sh"] diff --git a/create-db-and-upload-action/entrypoint.sh b/create-db-and-upload-action/entrypoint.sh index 62d68f7..7b70360 100755 --- a/create-db-and-upload-action/entrypoint.sh +++ b/create-db-and-upload-action/entrypoint.sh @@ -1,25 +1,27 @@ #!/bin/bash set -e +tree + init_path=$PWD mkdir upload_packages cp $local_path/*/*/*.tar.zst ./upload_packages/ if [ ! -f ~/.config/rclone/rclone.conf ]; then - mkdir --parents ~/.config/rclone - echo "[onedrive]" >> ~/.config/rclone/rclone.conf - echo "type = onedrive" >> ~/.config/rclone/rclone.conf - - echo "client_id=$RCLONE_ONEDRIVE_CLIENT_ID" >> ~/.config/rclone/rclone.conf - echo "client_secret=$RCLONE_ONEDRIVE_CLIENT_SECRET" >> ~/.config/rclone/rclone.conf - echo "region=$RCLONE_ONEDRIVE_REGION" >> ~/.config/rclone/rclone.conf - echo "drive_type=$RCLONE_ONEDRIVE_DRIVE_TYPE" >> ~/.config/rclone/rclone.conf - echo "token=$RCLONE_ONEDRIVE_TOKEN" >> ~/.config/rclone/rclone.conf - echo "drive_id=$RCLONE_ONEDRIVE_DRIVE_ID" >> ~/.config/rclone/rclone.conf + mkdir --parents ~/.config/rclone + echo "[onedrive]" >>~/.config/rclone/rclone.conf + echo "type = onedrive" >>~/.config/rclone/rclone.conf + + echo "client_id=$RCLONE_ONEDRIVE_CLIENT_ID" >>~/.config/rclone/rclone.conf + echo "client_secret=$RCLONE_ONEDRIVE_CLIENT_SECRET" >>~/.config/rclone/rclone.conf + echo "region=$RCLONE_ONEDRIVE_REGION" >>~/.config/rclone/rclone.conf + echo "drive_type=$RCLONE_ONEDRIVE_DRIVE_TYPE" >>~/.config/rclone/rclone.conf + echo "token=$RCLONE_ONEDRIVE_TOKEN" >>~/.config/rclone/rclone.conf + echo "drive_id=$RCLONE_ONEDRIVE_DRIVE_ID" >>~/.config/rclone/rclone.conf fi if [ ! -z "$GPG_PRIVATE_KEY" ]; then - echo "$GPG_PRIVATE_KEY" | gpg --import + echo "$GPG_PRIVATE_KEY" | gpg --import fi cd upload_packages || exit 1 @@ -30,17 +32,16 @@ python3 $init_path/create-db-and-upload-action/sync.py #rm "./${repo_name:?}.files.tar.gz" if [ ! -z "$GPG_PRIVATE_KEY" ]; then - packages=( "*.tar.zst" ) - for name in $packages - do - if [ ! -z "$GPG_PASSWORD" ]; then - gpg --batch --passphrase $GPG_PASSWORD --detach-sig --yes $name - repo-add --verify --sign "./${repo_name:?}.db.tar.gz" ./*.tar.zst - ls -al - else - gpg --detach-sig --yes $name - repo-add --verify --sign "./${repo_name:?}.db.tar.gz" ./*.tar.zst - fi - done + packages=("*.tar.zst") + for name in $packages; do + if [ ! -z "$GPG_PASSWORD" ]; then + gpg --batch --passphrase $GPG_PASSWORD --detach-sig --yes $name + repo-add --verify --sign "./${repo_name:?}.db.tar.gz" ./*.tar.zst + ls -al + else + gpg --detach-sig --yes $name + repo-add --verify --sign "./${repo_name:?}.db.tar.gz" ./*.tar.zst + fi + done fi rclone copy ./ "onedrive:${dest_path:?}" --copy-links