Update Sync (#36765)

This commit is contained in:
Shiming Zhang
2024-12-20 13:51:45 +08:00
committed by GitHub
parent 89369a6deb
commit e7678e9589
5 changed files with 41 additions and 90 deletions

View File

@@ -2,38 +2,23 @@ name: Sync
on:
schedule:
- cron: "0 12,18 * * *"
- cron: "1 * * * *"
workflow_dispatch:
jobs:
sync-images:
if: github.repository == 'DaoCloud/public-image-mirror'
runs-on: ubuntu-latest
if: github.repository == 'DaoCloud/public-image-mirror'
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Start Proxy
env:
only_proxy: "m.daocloud.io"
- name: Set up crproxy
run: |
wget https://github.com/wzshiming/bridge/releases/download/v0.9.0/bridge_linux_amd64 -O /usr/local/bin/bridge && chmod +x /usr/local/bin/bridge
nohup /usr/local/bin/bridge -b :8080 -p - ${{ secrets.PROTOCOL }} 2>/dev/null &
- name: Check Proxy
wget https://github.com/DaoCloud/crproxy/releases/download/v0.13.0-alpha.43/crproxy_linux_amd64 -O /usr/local/bin/crproxy && chmod +x /usr/local/bin/crproxy
- name: Sync Images to OSS&OBS
run: |
curl -v http://127.0.0.1:8080 || exit 1
curl -f --proxy 127.0.0.1:8080 -v http://m.daocloud.io/v2/ || exit 1
- name: Set up skopeo
run: |
wget https://github.com/lework/skopeo-binary/releases/download/v1.13.3/skopeo-linux-amd64 -O /usr/local/bin/skopeo && chmod +x /usr/local/bin/skopeo
skopeo --version
- name: Sync Images
env:
INCREMENTAL: "true"
QUICKLY: "true"
SYNC: "true"
PARALLET: "2"
http_proxy: socks5://127.0.0.1:8080
https_proxy: socks5://127.0.0.1:8080
run: |
./hack/diff.sh
ORIGIN_IMAGE=$(echo "${MESSAGE}" | grep SYNC | awk '{print $2}' | head -n 1 | sed "s/\r//g")
/usr/local/bin/crproxy sync --max-warn 100 ${{ secrets.STORAGE_ARGS }} --list-from-file ./mirror.txt