aboutsummaryrefslogtreecommitdiffstats
path: root/posts
diff options
context:
space:
mode:
authorFrançois Kooman <fkooman@tuxed.net>2018-06-08 17:48:17 +0200
committerFrançois Kooman <fkooman@tuxed.net>2018-06-08 17:48:17 +0200
commit1f6851a172830c435d37e81a49b9ecf7bb48cdc7 (patch)
treedd87ba43bf2899b6e4c61bfb38596f3345ca8b93 /posts
parente01075898304997b7f9d3a83954b9ac7876d65e4 (diff)
downloadwww.tuxed.net-1f6851a172830c435d37e81a49b9ecf7bb48cdc7.zip
www.tuxed.net-1f6851a172830c435d37e81a49b9ecf7bb48cdc7.tar.gz
www.tuxed.net-1f6851a172830c435d37e81a49b9ecf7bb48cdc7.tar.xz
add new post
Diffstat (limited to 'posts')
-rw-r--r--posts/git_signed_releases.md62
1 files changed, 62 insertions, 0 deletions
diff --git a/posts/git_signed_releases.md b/posts/git_signed_releases.md
new file mode 100644
index 0000000..335167f
--- /dev/null
+++ b/posts/git_signed_releases.md
@@ -0,0 +1,62 @@
+---
+title: Creating Signed Releases of your Git Projects
+published: 2018-06-08
+---
+
+This post describes how to create a PGP signed software release from your Git
+project.
+
+### Setup
+
+We want to use `tar.xz` archives, and not `zip` or `tar.gz`, for this to work
+we need to add a little snippet to `${HOME}/.gitconfig`:
+
+ [tar "tar.xz"]
+ command = xz -c
+
+Now, with that out of the way, you can put the following POSIX shell script in
+`${HOME}/.local/bin/make_release`. Make sure you make it "executable" with
+`chmod 0755 ${HOME}/.local/bin/make_release`:
+
+ #!/bin/sh
+ PROJECT_NAME=$(basename "${PWD}")
+ PROJECT_VERSION=${1}
+
+ if [ -z "${1}" ]
+ then
+ # we take the last "tag" of the Git repository as version
+ PROJECT_VERSION=$(git describe --abbrev=0 --tags)
+ echo Version: "${PROJECT_VERSION}"
+ fi
+
+ git archive "${PROJECT_VERSION}" -o "${PROJECT_NAME}-${PROJECT_VERSION}.tar.xz"
+ gpg2 --armor --detach-sign "${PROJECT_NAME}-${PROJECT_VERSION}.tar.xz"
+
+### Creating a Release
+
+Now, from your checked out repository you can run `make_release` and it will
+create (by default) a signed archive of the last (annotated) tag of the
+project. If you want to create a release of a specific tag, provide it as the
+first argument to `make_release`:
+
+ $ mkdir tmp && cd tmp
+ $ git clone https://git.tuxed.net/fkooman/php-yubitwee
+ $ cd php-yubitwee
+ $ make_release
+ Version: 1.1.4
+
+The following files are created:
+
+ $ ls -l php-yubitwee-*
+ -rw-rw-r--. 1 fkooman fkooman 8240 Jun 8 17:18 php-yubitwee-1.1.4.tar.xz
+ -rw-rw-r--. 1 fkooman fkooman 833 Jun 8 17:18 php-yubitwee-1.1.4.tar.xz.asc
+
+You can verify the signature:
+
+ $ gpg2 --verify php-yubitwee-1.1.4.tar.xz.asc
+ gpg: assuming signed data in 'php-yubitwee-1.1.4.tar.xz'
+ gpg: Signature made Fri 08 Jun 2018 05:18:37 PM CEST
+ gpg: using RSA key 6237BAF1418A907DAA98EAA79C5EDD645A571EB2
+ gpg: Good signature from "François Kooman <fkooman@tuxed.net>" [ultimate]
+
+Easy peasy ;-)