Skip to content

Instantly share code, notes, and snippets.

@Cloudef
Created June 15, 2017 13:38
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Cloudef/b86495ecccd2b8aa6fca542a4d82c136 to your computer and use it in GitHub Desktop.
Save Cloudef/b86495ecccd2b8aa6fca542a4d82c136 to your computer and use it in GitHub Desktop.
wlc release scripts
#!/bin/bash
# Archive git project including all submodules
# Usage: git archive-all <name> <ref>
set -eEuo pipefail
current="$(git rev-parse --abbrev-ref HEAD)"
toplevel="$(git rev-parse --show-toplevel)"
toplevel="${toplevel##*/}"
name="${1:-$toplevel}"
git checkout -q "${2:-HEAD}"
git submodule update -q --init --recursive
git archive --prefix "$name/" --format tar -o root.tar HEAD
git submodule foreach -q --recursive 'git archive --prefix="'"$name"'/$path/" --format tar -o "$sha1.tar" HEAD; tar -Af "$toplevel/root.tar" "$sha1.tar"; rm "$sha1.tar"'
bzip2 root.tar
mv root.tar.bz2 "$name.tar.bz2"
git checkout -q "$current"
git submodule update -q --init --recursive
#!/bin/sh
# Usage: ./make_release.sh new-tag-name
set -e
[ "$@" ] || { printf "missing release name\n" 1>&2; exit 1; }
git tag -s v"$@"
git archive-all wlc-"$@" v"$@"
rm -f wlc-"$@".tar.bz2.asc
gpg --armor --detach-sign wlc-"$@".tar.bz2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment