豆豆友情提示:这是一个非官方 GitHub 代理镜像,主要用于网络测试或访问加速。请勿在此进行登录、注册或处理任何敏感信息。进行这些操作请务必访问官方网站 github.com。 Raw 内容也通过此代理提供。
Skip to content

Commit faf76ec

Browse files
committed
perf(github-actions): compress preview artifacts before uploading
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
1 parent c3339f5 commit faf76ec

File tree

2 files changed

+16
-2
lines changed
  • github-actions/deploy-previews

2 files changed

+16
-2
lines changed

github-actions/deploy-previews/pack-and-upload-artifact/action.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,16 @@ runs:
5252
'${{inputs.pull-number}}' \
5353
'${{inputs.artifact-build-revision}}'
5454
55+
- name: Creating compressed tarball of artifact
56+
id: pack
57+
shell: bash
58+
run: |
59+
pkg="$RUNNER_TEMP/deploy-artifact.tar.gz"
60+
61+
tar -czvf "$pkg" -C '${{steps.copy.outputs.deploy-dir}}' .
62+
echo "artifact-path=$pkg" >> $GITHUB_OUTPUT
63+
5564
- uses: actions/upload-artifact@83fd05a356d7e2593de66fc9913b3002723633cb # renovate: tag=v3
5665
with:
5766
name: '${{inputs.workflow-artifact-name}}'
58-
path: '${{steps.copy.outputs.deploy-dir}}'
67+
path: '${{steps.pack.outputs.artifact-path}}'

github-actions/deploy-previews/upload-artifacts-to-firebase/action.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,13 @@ runs:
6161
- name: Extracting workflow artifact into Firebase public directory.
6262
shell: bash
6363
run: |
64+
extractDir="$RUNNER_TEMP/artifact-unpack"
65+
6466
mkdir -p '${{inputs.firebase-public-dir}}'
65-
unzip unsafe-artifact.zip -d '${{inputs.firebase-public-dir}}'
67+
mkdir -p "$extractDir"
68+
69+
unzip unsafe-artifact.zip -d "$extractDir"
70+
tar -xvzf "$extractDir/deploy-artifact.tar.gz" -C '${{inputs.firebase-public-dir}}'
6671
6772
- name: Extracting artifact metadata
6873
id: artifact-info

0 commit comments

Comments
 (0)