Add script that can produce a full source tarball

Full means "including git submodules" and makes it easier for folks to
download and build a release without sucking down large repos from
various locations, especially for folks with bandwidth constraints.

Upload the source tarball to the associated release.

Refs: https://github.com/wez/wezterm/issues/81
Refs: https://github.com/wez/wezterm/pull/46
Refs: https://github.com/wez/wezterm/pull/48
This commit is contained in:
Wez Furlong committed 2019-12-24 09:41:15 -08:00
1 parent fc6d80af0e
commit 11b79827de
5 files changed
+70 -4

No files matched your search

+3
View File
@@ -159,6 +159,8 @@ jobs:
assets: |
$(Build.SourcesDirectory)/*.zip
$(Build.SourcesDirectory)/*.deb
$(Build.SourcesDirectory)/*.tar.xz
$(Build.SourcesDirectory)/*.tar.gz
title: $(wezterm.tagname)
assetUploadMode: replace
addChangeLog: false
@@ -178,6 +180,7 @@ jobs:
$(Build.SourcesDirectory)/*.zip
$(Build.SourcesDirectory)/*.deb
$(Build.SourcesDirectory)/*.tar.xz
$(Build.SourcesDirectory)/*.tar.gz
title: "Nightly Builds"
assetUploadMode: replace
addChangeLog: false
+12 -3
View File
@@ -1,13 +1,22 @@
use vergen::{generate_cargo_keys, ConstantsFlags};
fn main() {
// Setup the flags, toggling off the 'SEMVER_FROM_CARGO_PKG' flag
let mut flags = ConstantsFlags::all();
flags.toggle(ConstantsFlags::SEMVER_FROM_CARGO_PKG);
flags.remove(ConstantsFlags::SEMVER_FROM_CARGO_PKG);
// Generate the 'cargo:' key output
generate_cargo_keys(ConstantsFlags::all()).expect("Unable to generate the cargo keys!");
// If a file named `.tag` is present, we'll take its contents for the
// version number that we report in wezterm -h.
let mut ci_tag = String::new();
if let Ok(tag) = std::fs::read(".tag") {
if let Ok(s) = String::from_utf8(tag) {
ci_tag = s.trim().to_string();
println!("cargo:rerun-if-changed=.tag");
}
}
println!("cargo:rustc-env=WEZTERM_CI_TAG={}", ci_tag);
#[cfg(windows)]
embed_resource::compile("assets/windows/resource.rc");
}
+2
View File
@@ -81,8 +81,10 @@ EOF
fakeroot dpkg-deb --build pkg/debian $debname.deb
tar cJf $debname.tar.xz -C pkg/debian/usr/bin wezterm
rm -rf pkg
;;
esac
./ci/source-archive.sh
;;
*)
+40
View File
@@ -0,0 +1,40 @@
#!/bin/bash
# Generate a source tarball that includes git submodules
set -x
TAG_NAME=${TAG_NAME:-$(git describe --tags)}
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}*
git archive --prefix=wezterm-${TAG_NAME}/ -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=wezterm-${TAG_NAME}/$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,^,wezterm-$TAG_NAME/," -c -f tmp.tar .tag
tar --concatenate --file=${TAR_NAME} tmp.tar
rm tmp.tar .tag
gzip ${TAR_NAME}
+13 -1
View File
@@ -44,11 +44,23 @@ use crate::font::FontConfiguration;
// terminal.advance_bytes(message);
// !=
fn wezterm_version() -> &'static str {
// Prefer our version override, if present (see build.rs)
let tag = env!("WEZTERM_CI_TAG");
if tag.is_empty() {
// Otherwise, fallback to the vergen-generated information,
// which is basically `git describe --tags` computed in build.rs
env!("VERGEN_SEMVER_LIGHTWEIGHT")
} else {
tag
}
}
#[derive(Debug, StructOpt)]
#[structopt(about = "Wez's Terminal Emulator\nhttp://github.com/wez/wezterm")]
#[structopt(raw(
global_setting = "structopt::clap::AppSettings::ColoredHelp",
version = r#"env!("VERGEN_SEMVER_LIGHTWEIGHT")"#,
version = r#"wezterm_version()"#,
))]
struct Opt {
/// Skip loading ~/.wezterm.toml