Skip to content

Commit 4049617

Browse files
committed
Add tarball packaging via 'make dist'
1 parent 8d29f4a commit 4049617

File tree

2 files changed

+33
-1
lines changed

2 files changed

+33
-1
lines changed

Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,7 @@ info:
1010
@rsync --version | head -1
1111
@echo
1212

13-
.PHONY: test info
13+
dist:
14+
@script/package-tarball
15+
16+
.PHONY: test info dist

script/package-tarball

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/bin/sh
2+
# Usage: script/package-tarball
3+
# Script to build a tarball release package from the current HEAD version.
4+
# The package version comes from `git-describe --tags' so the release tag should
5+
# be in place before this command is run.
6+
set -e
7+
8+
# Change into project root
9+
cd "$(dirname "$0")"/..
10+
11+
# Basic package name and version.
12+
PKG_BASE="github-backup-utils"
13+
PKG_VERS="$(git describe --tags)"
14+
PKG_NAME="${PKG_BASE}-${PKG_VERS}"
15+
16+
# Run git-archive to generate tarball
17+
echo "Creating ${PKG_NAME}.tar.gz ..."
18+
mkdir -p dist
19+
git archive \
20+
--format=tar.gz \
21+
--prefix="$PKG_NAME/" \
22+
--output="dist/${PKG_NAME}.tar.gz" \
23+
HEAD
24+
25+
# List archive contents for review
26+
gzip -dc < "dist/${PKG_NAME}.tar.gz" | tar tf -
27+
28+
# Output location
29+
echo "Package dist/${PKG_NAME}.tar.gz OK"

0 commit comments

Comments
 (0)