|
| 1 | +name: JP loadingbg sync |
| 2 | + |
| 3 | +permissions: |
| 4 | + contents: write # ✅ 必须,否则 Release 会失败 |
| 5 | + |
| 6 | +on: |
| 7 | + schedule: |
| 8 | + - cron: "0 3 * * *" # UTC 03:00 (≈ JST 12:00) |
| 9 | + workflow_dispatch: |
| 10 | + |
| 11 | +jobs: |
| 12 | + sync: |
| 13 | + runs-on: ubuntu-latest |
| 14 | + |
| 15 | + steps: |
| 16 | + - uses: actions/checkout@v4 |
| 17 | + |
| 18 | + - name: Set up Python |
| 19 | + uses: actions/setup-python@v5 |
| 20 | + with: |
| 21 | + python-version: "3.11" |
| 22 | + |
| 23 | + - name: Install azlassets |
| 24 | + run: | |
| 25 | + python -m pip install --upgrade pip |
| 26 | + pip install azlassets |
| 27 | +
|
| 28 | + - name: Download JP loadingbg assets |
| 29 | + run: | |
| 30 | + python -m downloader JP |
| 31 | +
|
| 32 | + # -------- 拉取上一次 Release 的 full 包 -------- |
| 33 | + - name: Download last full snapshot (if exists) |
| 34 | + env: |
| 35 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 36 | + run: | |
| 37 | + API="https://api.github.com/repos/${{ github.repository }}/releases/tags/jp-loadingbg-latest" |
| 38 | +
|
| 39 | + if curl -fsSL -H "Authorization: token $GITHUB_TOKEN" "$API" > release.json; then |
| 40 | + URL=$(jq -r '.assets[] | select(.name=="loadingbg_full.zip") | .browser_download_url' release.json) |
| 41 | + if [ -n "$URL" ]; then |
| 42 | + curl -L -o loadingbg_full.zip "$URL" |
| 43 | + unzip -q loadingbg_full.zip |
| 44 | + mv current_loadingbg last_loadingbg |
| 45 | + fi |
| 46 | + fi |
| 47 | +
|
| 48 | + - name: Collect loadingbg |
| 49 | + run: | |
| 50 | + python scripts/collect_loadingbg.py |
| 51 | +
|
| 52 | + - name: Diff and zip |
| 53 | + run: | |
| 54 | + bash scripts/diff_and_zip.sh |
| 55 | +
|
| 56 | + - name: Generate meta |
| 57 | + run: | |
| 58 | + echo "client=JP" > meta.txt |
| 59 | + echo "updated_at=$(date -u)" >> meta.txt |
| 60 | +
|
| 61 | + # -------- 发布 / 更新固定 Release -------- |
| 62 | + - name: Publish Release |
| 63 | + uses: softprops/action-gh-release@v2 |
| 64 | + with: |
| 65 | + tag_name: jp-loadingbg-latest |
| 66 | + name: JP loadingbg latest |
| 67 | + body: | |
| 68 | + Automated daily sync of JP loadingbg assetbundles. |
| 69 | +
|
| 70 | + - Full snapshot: loadingbg_full.zip |
| 71 | + - Incremental update: loadingbg_diff.zip |
| 72 | + files: | |
| 73 | + loadingbg_full.zip |
| 74 | + loadingbg_diff.zip |
| 75 | + meta.txt |
| 76 | +`` |
0 commit comments