Created
June 20, 2017 14:49
-
-
Save spvkgn/4c91eb03afbf3746313a34a48dee8528 to your computer and use it in GitHub Desktop.
Create tarball from git repo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
[ ! -z "$1" ] || exit | |
NAME=$1 ; cd $NAME | |
DATESTAMP=$(date +"%Y%m%d") | |
VERSION=$(git describe master --tags --match='v*' | sed 's/^v//' | cut -d- -f1) | |
COMMIT=$(git rev-parse --short=5 HEAD) | |
git archive master --format=tar.gz --prefix=$NAME-$VERSION~git$DATESTAMP.$COMMIT/ -o ../$NAME-$VERSION~git$DATESTAMP.$COMMIT.tar.gz |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
[ ! -z "$1" ] || exit | |
NAME=$1 ; cd $NAME | |
DATESTAMP=$(date +"%Y%m%d") | |
VERSION=$(git describe master --tags --match='v*' | sed 's/^v//' | cut -d- -f1) | |
COMMIT=$(git rev-parse --short=5 HEAD) | |
git archive master --prefix=$NAME-$VERSION+git$DATESTAMP.$COMMIT/ | xz -c > ../$NAME-$VERSION+git$DATESTAMP.$COMMIT.tar.xz |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment