This is an automated email from the ASF dual-hosted git repository.

kocolosk pushed a commit to branch prep-for-release
in repository https://gitbox.apache.org/repos/asf/couchdb-b64url.git

commit 5494f52bbd126b891908deb1bacc9b0e3e544031
Author: Adam Kocoloski <kocol...@apache.org>
AuthorDate: Thu Nov 18 16:28:39 2021 -0500

    Add `make dist` target to generate source release
---
 .gitattributes |  6 ++++++
 Makefile       | 14 ++++++++++++++
 2 files changed, 20 insertions(+)

diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..e25b690
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,6 @@
+.asf.yaml           export-ignore
+.devcontainer/      export-ignore
+.gitattributes      export-ignore
+.github/            export-ignore
+.gitignore          export-ignore
+.gitmodules         export-ignore
diff --git a/Makefile b/Makefile
index 1f7b0bd..c933931 100644
--- a/Makefile
+++ b/Makefile
@@ -12,6 +12,7 @@
 
 REBAR?=rebar3
 
+VERSION = $(shell git describe --tags --always --first-parent)
 
 .PHONY: all
 # target: all - Makes everything
@@ -29,6 +30,19 @@ build:
 check: build eunit
 
 
+.PHONY: dist
+# target: dist - Generate source release
+# A little bit of explanation for the untar + sed + tar dance below.
+# During development we dynamically generate the vsn in the .app file
+# using {vsn, git}. We can't do that in the actual source release
+# because it's not a git repo, so we inject the version string into the
+# archived app.src file and then repackage the archive for shipping.
+dist:
+       @git archive --prefix=b64url-${VERSION}/ HEAD | tar xf -
+       @sed --in-place -e "s/{vsn, git}/{vsn, \"${VERSION}\"}/" 
b64url-${VERSION}/src/b64url.app.src
+       @tar czf b64url-${VERSION}.tar.gz b64url-${VERSION}
+
+
 .PHONY: clean
 # target: clean - Removes build artifacts
 clean:

Reply via email to