Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
bytecodealliance
GitHub Repository: bytecodealliance/wasmtime
Path: blob/main/ci/merge-artifacts.sh
1685 views
1
#!/bin/bash
2
3
# Script to merge the outputs of a run on github actions to github releases.
4
# This is invoked from `.github/workflows/publish-artifacts.yml`. All previous
5
# artifacts from builds are located in `bins-*` folders. The main purpose of
6
# this script is to take the "min" build and merge it into the "normal" build to
7
# produce one final tarball. This means that the final artifacts will have both
8
# a normal and a min build in them for comparison and usage.
9
10
set -ex
11
12
# Prepare the upload folder and move all artifacts that aren't being merged into
13
# this folder, e.g. the MSI installer and adapter wasm files.
14
rm -rf dist
15
mkdir dist
16
mv -t dist bins-*/*.{msi,wasm}
17
mv wasmtime-platform-header/* dist
18
19
# Merge tarballs and zips by searching for `*-min` builds, unpacking the
20
# min/normal builds, into the same destination, and then repacking into a
21
# tarball.
22
#
23
# Note that for now xz compression is used for the final artifact to try to get
24
# small artifacts, but it's left at the default level since a lot of artifacts
25
# are processed here and turning it up to the max 9 compression might take
26
# quite awhile on CI for this one builder to process.
27
for min in bins-*-min/*.tar.*; do
28
normal=${min/-min\//\/}
29
filename=$(basename $normal)
30
dir=${filename%.tar.gz}
31
32
rm -rf tmp
33
mkdir tmp
34
tar xf $min -C tmp
35
tar xf $normal -C tmp
36
tar -cf - -C tmp $dir | xz -T0 > dist/$dir.tar.xz
37
rm $min $normal
38
done
39
40
for min in bins-*-min/*.zip; do
41
normal=${min/-min\//\/}
42
filename=$(basename $normal)
43
dir=${filename%.zip}
44
45
rm -rf tmp
46
mkdir tmp
47
(cd tmp && unzip -o ../$min)
48
(cd tmp && unzip -o ../$normal)
49
(cd tmp && 7z a ../dist/$dir.zip $dir/)
50
rm $min $normal
51
done
52
53
# Copy over remaining source tarball into the dist folder
54
mv -t dist bins-*/*.tar.*
55
56