This repository was archived by the owner on Jun 15, 2025. It is now read-only.
Download new assets #30222
This file contains hidden or 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
| name: Download new assets | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: '*/10 * * * *' | |
| concurrency: | |
| group: ${{ github.workflow }} | |
| jobs: | |
| update: | |
| name: Update assets | |
| runs-on: ubuntu-latest | |
| permissions: write-all | |
| strategy: | |
| matrix: | |
| server: [cn, en, jp, kr, tw] | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Remove all .NET versions | |
| run: | | |
| sudo apt-get remove --purge -y dotnet* || true | |
| sudo apt-get autoremove -y | |
| sudo rm -rf /usr/share/dotnet /etc/dotnet | |
| - name: Install .NET 6.0 | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: 6.0.x | |
| - name: Install python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.13' | |
| - name: Update assets | |
| run: | | |
| python3 -m pip install requests | |
| sudo python3 download.py ${{ matrix.server }} | |
| echo "VERSION_ID=$(jq -r .versionId "hot_update_list-${{ matrix.server }}.json")" >> $GITHUB_ENV | |
| - name: Upload assets | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: assets_${{ matrix.server }}_${{ env.VERSION_ID }} | |
| if-no-files-found: ignore | |
| path: ./assets | |
| - name: Upload bundles | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: bundles_${{ matrix.server }}_${{ env.VERSION_ID }} | |
| if-no-files-found: ignore | |
| path: ./bundles | |
| push: | |
| name: Update links | |
| runs-on: ubuntu-latest | |
| permissions: write-all | |
| needs: update | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Edit README.md with new files | |
| run: | | |
| while read -r name id size; do | |
| if [[ $name =~ (.*)_(.*)_(.*) ]]; then | |
| type=${BASH_REMATCH[1]} | |
| server=${BASH_REMATCH[2]} | |
| version=${BASH_REMATCH[3]} | |
| new="[${type}_${server}_${version}](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts/$id) ($(numfmt --to=iec $size)iB)" | |
| hooktext=${hooktext}\\n${new} | |
| sed -i "s|\[${type}_${server}_.*\][(].*[)] [(].*B[)]|${new}|" README.md | |
| bash download.sh $server test | |
| fi | |
| done < <( | |
| gh api /repos/${{ github.repository }}/actions/artifacts | | |
| jq -r -c '.artifacts | map(select(.workflow_run.id==${{ github.run_id }})) | .[] | "\(.name) \(.id) \(.size_in_bytes)"' | |
| ) | |
| if [[ $hooktext != "" ]]; then | |
| curl "${{ vars.DISCORD_WEBHOOK }}" -H 'content-type: application/json' \ | |
| --data-raw "{\"embeds\":[{\"title\":\"New arknights update\",\"description\":\"${hooktext}\"}]}" | |
| fi | |
| - name: Push changes | |
| uses: stefanzweifel/git-auto-commit-action@v5 | |
| with: | |
| commit_message: update |