Skip to content

Commit 4d57115

Browse files
committed
Compress release assets before uploading them to Github
With debug symbols enabled, the built executables can get quite large, so we want to compress them to save some disk space and network bandwidth. Also, change the asset naming convention to include the arch name.
1 parent 6294e03 commit 4d57115

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

.github/workflows/release.yml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,20 @@ jobs:
7474
args: --release
7575

7676
- run: |
77+
rustc --print cfg | grep = > rustc.vars
78+
source rustc.vars
79+
80+
pushd target/release
7781
if [ "$RUNNER_OS" == "Windows" ]; then
78-
echo "ASSET_NAME=xsnippet-api-${{ matrix.os }}.exe" >> $GITHUB_ENV
79-
echo "ASSET_PATH=./target/release/xsnippet-api.exe" >> $GITHUB_ENV
82+
echo "ASSET_NAME=xsnippet-api-${target_arch}-${target_os}.exe.7z" >> $GITHUB_ENV
83+
echo "ASSET_PATH=./target/release/xsnippet-api.exe.7z" >> $GITHUB_ENV
84+
7z a xsnippet-api.exe.7z xsnippet-api.exe
8085
else
81-
echo "ASSET_NAME=xsnippet-api-${{ matrix.os }}" >> $GITHUB_ENV
82-
echo "ASSET_PATH=./target/release/xsnippet-api" >> $GITHUB_ENV
86+
echo "ASSET_NAME=xsnippet-api-${target_arch}-${target_os}.gz" >> $GITHUB_ENV
87+
echo "ASSET_PATH=./target/release/xsnippet-api.gz" >> $GITHUB_ENV
88+
tar cvzf xsnippet-api.gz xsnippet-api
8389
fi
90+
popd
8491
8592
- uses: actions/upload-release-asset@v1
8693
env:

0 commit comments

Comments
 (0)