1
1
mirror of https://github.com/wez/wezterm.git synced 2024-09-19 18:57:59 +03:00
wezterm/ci/source-archive.sh
Wez Furlong 35eb7383b1 ci: simplify version number
Previously, we used `git describe --tags` to produce a version number
for non-released builds derived from the most recent tag + some info
such as the number of commits since that tag and then `g{HASH}`.

That always confuses people because the date portion at the front
looks old (it is typically the previous release) and the hash at
the end has that `g` in it.

This commit simplifies both the tag name used when making a release
and the computed version number take the date/time from the current
commit, and then append the hash.  That way the version number always
corresponds to a commit.

This scheme doesn't help detect situations where the commit is
dirty, but I don't think the old one would have helped with that
either.
2021-04-29 20:23:47 -07:00

50 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
# Generate a source tarball that includes git submodules
set -x
TAG_NAME=${TAG_NAME:-$(git show -s "--format=%cd-%h" "--date=format:%Y%m%d-%H%M%S")}
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}