Skip to content

Commit 116dc82

Browse files
Williangalvanipatrickelectric
authored andcommitted
CI: split zip files into 2gb~ish chunks
1 parent 0392e1e commit 116dc82

File tree

1 file changed

+17
-28
lines changed

1 file changed

+17
-28
lines changed

.github/workflows/test-and-deploy.yml

Lines changed: 17 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -338,29 +338,29 @@ jobs:
338338
- name: Sanitize platform name
339339
run: echo "SANITIZED_PLATFORM=$(echo ${{ matrix.platform }} | tr '/' '-')" >> $GITHUB_ENV
340340

341+
- name: Set asset name
342+
run: |
343+
if [[ ${{ matrix.runner }} == 'pi5-builder' ]]; then
344+
echo "ASSET_NAME_SUFFIX=-pi5" >> $GITHUB_ENV
345+
elif [[ ${{ matrix.os }} == 'bullseye' ]]; then
346+
echo "ASSET_NAME_SUFFIX=-pi4" >> $GITHUB_ENV
347+
fi
348+
341349
- name: Zip image
342350
run: |
343351
sudo apt install zip
344-
zip -9 BlueOS-raspberry-${{ env.SANITIZED_PLATFORM }}-${{ matrix.os }}.zip deploy/pimod/blueos.img
345-
ls -lah BlueOS-raspberry-${{ env.SANITIZED_PLATFORM }}-${{ matrix.os }}.zip
352+
zip -9 -s 2000m BlueOS-raspberry-${{ env.SANITIZED_PLATFORM }}-${{ matrix.os }}${{ env.ASSET_NAME_SUFFIX }}.zip deploy/pimod/blueos.img
353+
ls -lah BlueOS-raspberry-${{ env.SANITIZED_PLATFORM }}-${{ matrix.os }}${{ env.ASSET_NAME_SUFFIX }}*
346354
347355
- name: Upload artifact
348356
uses: actions/upload-artifact@v4
349357
timeout-minutes: 120
350358
with:
351-
name: BlueOS-raspberry-${{ env.GITHUB_REF_NAME }}${{ env.SANITIZED_PLATFORM }}-${{ matrix.os }}
352-
path: BlueOS-raspberry-${{ env.SANITIZED_PLATFORM }}-${{ matrix.os }}.zip
359+
name: BlueOS-raspberry-${{ env.GITHUB_REF_NAME }}${{ env.SANITIZED_PLATFORM }}-${{ matrix.os }}${{ env.ASSET_NAME_SUFFIX }}
360+
path: BlueOS-raspberry-${{ env.SANITIZED_PLATFORM }}-${{ matrix.os }}${{ env.ASSET_NAME_SUFFIX }}.z*
353361
if-no-files-found: error
354362
retention-days: 7
355363

356-
- name: Set asset name
357-
run: |
358-
if [[ ${{ matrix.runner }} == 'pi5-builder' ]]; then
359-
echo "ASSET_NAME_SUFFIX=-pi5" >> $GITHUB_ENV
360-
elif [[ ${{ matrix.os }} == 'bullseye' ]]; then
361-
echo "ASSET_NAME_SUFFIX=-pi4" >> $GITHUB_ENV
362-
fi
363-
364364
- name: Configure AWS credentials
365365
uses: aws-actions/configure-aws-credentials@v4
366366
if: startsWith(github.ref, 'refs/tags/')
@@ -372,27 +372,16 @@ jobs:
372372
- name: Upload to S3
373373
if: startsWith(github.ref, 'refs/tags/')
374374
run: |
375-
aws s3 cp BlueOS-raspberry-${{ env.SANITIZED_PLATFORM }}-${{ matrix.os }}.zip s3://blueos-downloads/releases/${{ github.ref_name }}/
376-
377-
- name: Check file size
378-
id: check_size
379-
run: |
380-
FILE_SIZE=$(stat -c%s "BlueOS-raspberry-${{ env.SANITIZED_PLATFORM }}-${{ matrix.os }}.zip")
381-
echo "File size: $FILE_SIZE bytes"
382-
if [ "$FILE_SIZE" -lt 2147483648 ]; then
383-
echo "upload_allowed=true" >> $GITHUB_OUTPUT
384-
else
385-
echo "upload_allowed=false" >> $GITHUB_OUTPUT
386-
echo "::warning::File size ($FILE_SIZE bytes) exceeds 2GB limit, skipping GitHub release upload"
387-
fi
375+
aws s3 cp deploy/pimod/blueos.img s3://blueos-downloads/releases/${{ github.ref_name }}/BlueOS-raspberry-${{ env.SANITIZED_PLATFORM }}-${{ matrix.os }}${{ env.ASSET_NAME_SUFFIX }}.img
388376
389377
- name: Upload raspberry image for release
390378
uses: svenstaro/upload-release-action@v2
391-
if: startsWith(github.ref, 'refs/tags/') && steps.check_size.outputs.upload_allowed == 'true'
379+
if: startsWith(github.ref, 'refs/tags/')
392380
with:
393381
repo_token: ${{ secrets.GITHUB_TOKEN }}
394-
file: BlueOS-raspberry-${{ env.SANITIZED_PLATFORM }}-${{ matrix.os }}.zip
395-
asset_name: BlueOS-raspberry-${{ env.SANITIZED_PLATFORM }}-${{ matrix.os }}${{ env.ASSET_NAME_SUFFIX }}.zip
382+
# Matches single .zip or multi-volume .z01, .z02, ..., .zip
383+
file: BlueOS-raspberry-${{ env.SANITIZED_PLATFORM }}-${{ matrix.os }}${{ env.ASSET_NAME_SUFFIX }}.z*
384+
file_glob: true
396385
tag: ${{ github.ref }}
397386
overwrite: true
398387
prerelease: true

0 commit comments

Comments
 (0)