Skip to content

Commit

Permalink
perf(github-actions): compress preview artifacts before uploading
Browse files Browse the repository at this point in the history
The `actions/upload` infrastructure will upload all files individually,
but we can compress it directly beforehand and just upload a single
smaller file.

This means that we need to unzip -> and then untar as GitHub
always zips up the artifacts regardless when they are uploaded.

This is expected and recommended as per:
https://github.com/actions/upload-artifact
  • Loading branch information
devversion committed Dec 7, 2022
1 parent c3339f5 commit faf76ec
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,16 @@ runs:
'${{inputs.pull-number}}' \
'${{inputs.artifact-build-revision}}'
- name: Creating compressed tarball of artifact
id: pack
shell: bash
run: |
pkg="$RUNNER_TEMP/deploy-artifact.tar.gz"
tar -czvf "$pkg" -C '${{steps.copy.outputs.deploy-dir}}' .
echo "artifact-path=$pkg" >> $GITHUB_OUTPUT
- uses: actions/upload-artifact@83fd05a356d7e2593de66fc9913b3002723633cb # renovate: tag=v3
with:
name: '${{inputs.workflow-artifact-name}}'
path: '${{steps.copy.outputs.deploy-dir}}'
path: '${{steps.pack.outputs.artifact-path}}'
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,13 @@ runs:
- name: Extracting workflow artifact into Firebase public directory.
shell: bash
run: |
extractDir="$RUNNER_TEMP/artifact-unpack"
mkdir -p '${{inputs.firebase-public-dir}}'
unzip unsafe-artifact.zip -d '${{inputs.firebase-public-dir}}'
mkdir -p "$extractDir"
unzip unsafe-artifact.zip -d "$extractDir"
tar -xvzf "$extractDir/deploy-artifact.tar.gz" -C '${{inputs.firebase-public-dir}}'
- name: Extracting artifact metadata
id: artifact-info
Expand Down

0 comments on commit faf76ec

Please sign in to comment.