Debian Codegraph @

ci/build-tarballs.sh

raw
1 #!/bin/bash
2
3 set -ex
4
5 platform=$1
6 target=$2
7
8 rm -rf tmp
9 mkdir tmp
10 mkdir -p dist
11
12 tag=$(./ci/print-current-version.sh)
13 bin_pkgname=wasm-tools-$tag-$platform
14
15 mkdir tmp/$bin_pkgname
16 cp LICENSE-* README.md tmp/$bin_pkgname
17
18 fmt=tar
19 if [ "$platform" = "x86_64-windows" ]; then
20 cp target/release/wasm-tools.exe tmp/$bin_pkgname
21 fmt=zip
22 elif [ "$target" = "wasm32-wasip1" ]; then
23 cp target/wasm32-wasip1/release/wasm-tools.wasm tmp/$bin_pkgname
24 elif [ "$target" = "" ]; then
25 cp target/release/wasm-tools tmp/$bin_pkgname
26 else
27 cp target/$target/release/wasm-tools tmp/$bin_pkgname
28 fi
29
30
31 mktarball() {
32 dir=$1
33 if [ "$fmt" = "tar" ]; then
34 tar czvf dist/$dir.tar.gz -C tmp $dir
35 else
36 # Note that this runs on Windows, and it looks like GitHub Actions doesn't
37 # have a `zip` tool there, so we use something else
38 (cd tmp && 7z a ../dist/$dir.zip $dir/)
39 fi
40 }
41
42 mktarball $bin_pkgname