Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] master from immortalwrt:master #2

Open
wants to merge 20 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 24 additions & 55 deletions .github/workflows/update-mirror.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SPDX-License-Identifier: GPL-3.0-only
# SPDX-License-Identifier: GPL-2.0-only
#
# Copyright (C) 2021 ImmortalWrt.org

Expand All @@ -8,36 +8,33 @@ on:
repository_dispatch:
workflow_dispatch:
schedule:
- cron: 0 */8 * * *
- cron: 0 2 * * *

jobs:
update-mirror:
runs-on: ubuntu-18.04
runs-on: ubuntu-latest
strategy:
matrix:
branch:
- openwrt-18.06
- openwrt-18.06-k5.4
- openwrt-21.02
- master
- openwrt-23.05
fail-fast: false
max-parallel: 1

steps:
- name: Checkout the Repo
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Init Compilation Dependencies
env:
DEBIAN_FRONTEND: noninteractive
run: |
sudo -E apt-get -qq update
sudo -E apt-get -qq install build-essential libncurses5-dev binutils bzip2 coreutils gawk gettext git patch zlib1g-dev subversion git-core gcc g++ p7zip-full libssl-dev autoconf automake libtool autopoint curl wget vim nano python3 python3-pip xz-utils tar unzip rsync
sudo -E -H pip3 install -r aliyundrive-uploader/requirements.txt
sudo -E apt-get -qq clean

- name: Checkout ImmortalWrt Source Tree on Branch ${{ matrix.branch }}
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
repository: "immortalwrt/immortalwrt"
ref: ${{ matrix.branch }}
Expand All @@ -54,64 +51,36 @@ jobs:
cd "immortalwrt"
echo -e "CONFIG_ALL=y" > ".config"
make defconfig
make download -j128
make download -j8
find dl -size -1024c -exec rm -f {} \;

- name: Fetch Cached Uploaded Files List
uses: actions/cache@v2
with:
path: "uploaded-files"
key: immortalwrt-mirror-uploaded-${{ matrix.branch }}-${{ github.run_id }}
restore-keys: |
immortalwrt-mirror-uploaded-

- name: Fetch Cached Uploader Keys
uses: actions/cache@v2
with:
path: "uploader-keys"
key: immortalwrt-mirror-uploader-${{ github.run_id }}
restore-keys: |
immortalwrt-mirror-uploader-

- name: Upload Files to OneDrive
- name: Upload Files to ImmortalWrt Download Server
env:
ODRS_REFRESH_TOKEN: ${{ secrets.ODRS_REFRESH_TOKEN }}
UPLOADER_TYPE: "onedrive"
UPLOADER_CONF: "uploader.json"
RSYNC_ADDR: ${{ secrets.RSYNC_ADDR }}
RSYNC_USER: ${{ secrets.RSYNC_USER }}
RSYNC_PASSWORD: ${{ secrets.RSYNC_PASS }}
run: |
./uploader-cache/detect-upload-files.sh
[ "$(ls -A "package-sources"/* | wc -l)" -gt "0" ] || exit 0
[ -f "uploader-keys/$UPLOADER_TYPE.json" ] && cp -f "uploader-keys/$UPLOADER_TYPE.json" "$UPLOADER_CONF" || ./onedrive-uploader/gen-onedriveconf.sh
./onedrive-uploader/OneDriveUploader -f -c "$UPLOADER_CONF" -s "package-sources" -r "/"
./uploader-cache/gen-downloaded-hash.sh
[ -d "uploader-keys" ] || mkdir -p "uploader-keys"
cp -f "$UPLOADER_CONF" "uploader-keys/$UPLOADER_TYPE.json"
find 'immortalwrt/dl/' -maxdepth 1 -type f -not -size 0 -not -name '.*' -not -name '*.hash' -not -name '*.dl' -printf '%f\n' > 'sourcelist'
rsync --files-from="sourcelist" --size-only --delay-updates --partial-dir=".~tmp~$GITHUB_RUN_ID" -ahv "immortalwrt/dl/" "rsync://${RSYNC_USER}@${RSYNC_ADDR}/dl/"

- name: Upload Files to AliyunDrive
- name: Upload Files to SourceForge
uses: Pendect/action-rsyncer@9738db02560c333bf629a1533bd86ceda138e599
with:
flags: '-ahv'
options: '--files-from=sourcelist --size-only'
src: 'immortalwrt/dl/'
dest: '${{ secrets.SF_USER }}@frs.sourceforge.net:/home/frs/project/immortalwrt/sources/'
env:
UPLOADER_TYPE: "alidrive"
ALI_DRIVE_ID: ${{ secrets.ALI_DRIVE_ID }}
ALI_REFRESH_TOKEN: ${{ secrets.ALI_REFRESH_TOKEN }}
run: |
./uploader-cache/detect-upload-files.sh
[ "$(ls -A "package-sources"/* | wc -l)" -gt "0" ] || exit 0
pushd aliyundrive-uploader
[ -f "../uploader-keys/$UPLOADER_TYPE.json" ] && cp -f "../uploader-keys/$UPLOADER_TYPE.json" "config.json" || ./gen-alidriveconf.sh
[ -f "../uploader-keys/$UPLOADER_TYPE.db" ] && cp -f "../uploader-keys/$UPLOADER_TYPE.db" "db.db"
python3 main.py || echo "Never mind."
popd
./uploader-cache/gen-downloaded-hash.sh
[ -d "uploader-keys" ] || mkdir -p "uploader-keys"
cp -f "aliyundrive-uploader/config.json" "uploader-keys/$UPLOADER_TYPE.json"
cp -f "aliyundrive-uploader/db.db" "uploader-keys/$UPLOADER_TYPE.db"
DEPLOY_KEY: ${{ secrets.SF_KEY }}

cleanup-workflow-runs:
runs-on: ubuntu-18.04
runs-on: ubuntu-latest
needs: update-mirror
steps:
- name: Cleanup Workflow Runs
uses: GitRML/delete-workflow-runs@v1.2.1
uses: Mattraks/delete-workflow-runs@v2
with:
token: ${{ github.token }}
repository: ${{ github.repository }}
retain_days: 7
keep_minimum_runs: 1
Loading