1
1
mirror of https://github.com/wez/wezterm.git synced 2024-12-19 11:21:39 +03:00
wezterm/ci/source-archive.sh
Wez Furlong 57f1aa2785 fixup build to not consider termwiz tags as wezterm tags
CI got broken by the termwiz release.  This commit teaches the
various `git describe --tags` calls to filter to the wezterm
tags which all start with the year.  We're match `20*` which should
be good for the next 79 years.

I've removed the vergen dependency as there was no way to teach it
to do the equivalent matching, and it wasn't a terrible burden
to just inline the git describe call anyway.
2021-03-17 21:02:03 -07:00

51 lines
1.3 KiB
Bash
Executable File

#!/bin/bash
# Generate a source tarball that includes git submodules
set -x
TAG_NAME=${TAG_NAME:-$(git describe --tags --match '20*')}
TAG_NAME=${TAG_NAME:-$(date +'%Y%m%d-%H%M%S')-$(git log --format=%h -1)}
if [[ "$BUILD_REASON" == "Schedule" ]] ; then
TAR_NAME=wezterm-nightly-src.tar
else
TAR_NAME=wezterm-${TAG_NAME}-src.tar
fi
rm -f ${TAR_NAME}*
NAME_PREFIX=wezterm-${TAG_NAME}
git archive --prefix=${NAME_PREFIX}/ -o ${TAR_NAME} HEAD
p=`pwd`
# `git submodule foreach` outputs lines like:
# Enter 'path'
# So we need to focus on the path and strip the quotes
git submodule foreach | while read entering path; do
path="${path%\'}";
path="${path#\'}";
[ "$path" = "" ] && continue;
cd $path
git archive --prefix=${NAME_PREFIX}/$path/ HEAD > tmp.tar && \
tar --concatenate --file=$p/${TAR_NAME} tmp.tar
rm tmp.tar
cd $p
done
echo $TAG_NAME > .tag
tar --owner root --group root --transform "s,^,$NAME_PREFIX/," -c -f tmp.tar .tag
tar --concatenate --file=${TAR_NAME} tmp.tar
rm tmp.tar .tag
# Remove bulky bits that are not required to build from source; this helps
# to keep the source tarball small!
tar --delete \
${NAME_PREFIX}/deps/harfbuzz/harfbuzz/test \
${NAME_PREFIX}/deps/freetype/libpng/contrib \
${NAME_PREFIX}/docs/screenshots \
-f ${TAR_NAME}
gzip ${TAR_NAME}