1.4.1 #991
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: Create zip files | |
| on: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| create-zip-files: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Create name version env | |
| run: | | |
| export TZ=UTC | |
| ts=$(git log -1 --format=%ct) | |
| yy=$(date -d "@$ts" +%y) | |
| mm=$(date -d "@$ts" +%m) | |
| month_start=$(date -d "20$yy-$mm-01 00:00:00" +%s) | |
| count=$(git rev-list --count HEAD --since="$month_start") | |
| version_current="v$yy.$mm.$(printf "%02d" "$count")" | |
| echo "VERSION_CURRENT=$version_current" >> $GITHUB_ENV | |
| - name: Move binaries | |
| run: | | |
| mkdir -p ./exclude/bin ./exclude/resources | |
| cp -R ./bin/* ./exclude/bin | |
| cp -R ./resources/* ./exclude/resources | |
| rm -rf ./bin/* ./resources/* | |
| mkdir -p ./bin/macos/arm64 ./bin/linux/arm64 ./bin/linux/x86_64 | |
| mv ./exclude/bin/linux/arm64/aria2c ./exclude/bin/linux/arm64/jq ./bin/linux/arm64 | |
| mv ./exclude/bin/linux/x86_64/aria2c ./exclude/bin/linux/x86_64/jq ./bin/linux/x86_64 | |
| mv ./exclude/bin/macos/aria2c ./exclude/bin/macos/jq ./bin/macos | |
| mv ./exclude/bin/macos/arm64/aria2c ./exclude/bin/macos/arm64/jq ./bin/macos/arm64 | |
| touch ./resources/new | |
| - name: Zip files | |
| run: zip -r ${{ github.event.repository.name }}_${{ env.VERSION_CURRENT }}.zip bin/ LICENSE resources/ restore.sh README.md | |
| - name: Remove all assets from latest release | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| assets=$(gh release view latest --json assets -q '.assets[].name' || true) | |
| if [[ -z "$assets" ]]; then | |
| echo "No assets found on release 'latest'" | |
| exit 0 | |
| fi | |
| for asset in $assets; do | |
| echo "Deleting asset: $asset" | |
| gh release delete-asset latest "$asset" -R ${{ github.repository }} -y | |
| done | |
| - name: Update latest release | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| gh release upload latest \ | |
| ${{ github.event.repository.name }}_${{ env.VERSION_CURRENT }}.zip \ | |
| --clobber -R ${{ github.repository }} | |
| gh release edit latest \ | |
| --title "Latest-${{ env.VERSION_CURRENT }}" \ | |
| --target ${{ github.sha }} -R ${{ github.repository }} |