Recompress ArchiSteamFarm #280
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: Recompress ArchiSteamFarm | |
| on: | |
| push: | |
| schedule: | |
| - cron: "0 2 * * *" | |
| workflow_dispatch: | |
| jobs: | |
| recompress: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v5 | |
| - name: Install required software | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y p7zip-full jq curl unzip | |
| - name: Get latest stable ASF release info | |
| id: get_release | |
| run: | | |
| # Fetch all releases, then filter out prereleases, take the first (most recent stable) | |
| rel=$(curl -s https://api.github.com/repos/JustArchiNET/ArchiSteamFarm/releases \ | |
| | jq 'map(select(.prerelease == false)) | .[0]') | |
| tag=$(echo "$rel" | jq -r .tag_name) | |
| title=$(echo "$rel" | jq -r .name) | |
| linux_url=$(echo "$rel" | jq -r '.assets[] | select(.name == "ASF-linux-x64.zip") | .browser_download_url') | |
| win_url=$(echo "$rel" | jq -r '.assets[] | select(.name == "ASF-win-x64.zip") | .browser_download_url') | |
| echo "tag=$tag" >> $GITHUB_OUTPUT | |
| echo "title=$title" >> $GITHUB_OUTPUT | |
| echo "linux_url=$linux_url" >> $GITHUB_OUTPUT | |
| echo "win_url=$win_url" >> $GITHUB_OUTPUT | |
| - name: Check if release already exists | |
| id: check_release | |
| run: | | |
| existing=$(curl -s \ | |
| -H "Authorization: token ${{ vars.PAT_TOKEN }}" \ | |
| https://api.github.com/repos/${{ github.repository }}/releases/tags/${{ steps.get_release.outputs.tag }}) | |
| if echo "$existing" | grep -q '"id":'; then | |
| echo "already_exists=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "already_exists=false" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Download & recompress builds | |
| if: steps.check_release.outputs.already_exists == 'false' | |
| run: | | |
| tag="${{ steps.get_release.outputs.tag }}" | |
| # Linux build | |
| curl -L -o ASF-linux-x64.zip "${{ steps.get_release.outputs.linux_url }}" | |
| mkdir asf-linux | |
| unzip -q ASF-linux-x64.zip -d asf-linux | |
| 7z a -t7z -mx=9 "ASF-linux-x64-${tag}.7z" ./asf-linux/* | |
| # Windows build | |
| curl -L -o ASF-win-x64.zip "${{ steps.get_release.outputs.win_url }}" | |
| mkdir asf-win | |
| unzip -q ASF-win-x64.zip -d asf-win | |
| 7z a -t7z -mx=9 "ASF-win-x64-${tag}.7z" ./asf-win/* | |
| - name: Create new release | |
| if: steps.check_release.outputs.already_exists == 'false' | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ steps.get_release.outputs.tag }} | |
| name: "${{ steps.get_release.outputs.title }} recompressed" | |
| body: "Recompressed from the original ASF release at https://github.com/JustArchiNET/ArchiSteamFarm/releases/tag/${{ steps.get_release.outputs.tag }}" | |
| draft: false | |
| prerelease: false | |
| files: | | |
| ASF-linux-x64-${{ steps.get_release.outputs.tag }}.7z | |
| ASF-win-x64-${{ steps.get_release.outputs.tag }}.7z | |
| token: ${{ vars.PAT_TOKEN }} |