From a261b8986488f24352a47e00a67217218242c02f Mon Sep 17 00:00:00 2001 From: Jimmy Cuadra Date: Thu, 12 May 2016 23:11:00 -0700 Subject: [PATCH] Add distribution targets to Makefile. --- Dockerfile | 1 - Makefile | 34 ++++++++++++++++++++++++++++------ README.md | 8 ++++++++ 3 files changed, 36 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index 7f64aa4..42b91ea 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,4 +3,3 @@ FROM scratch ENTRYPOINT ["/ktmpl"] COPY target/x86_64-unknown-linux-musl/release/ktmpl /ktmpl - diff --git a/Makefile b/Makefile index 66cabc7..3ea530e 100644 --- a/Makefile +++ b/Makefile @@ -1,15 +1,37 @@ -all: cargo-build docker-build +TAG = 0.2.1 -cargo-build: +all: dist + +.PHONY: target/release/ktmpl +target/release/ktmpl: + cargo build --release + +.PHONY: target/x86_64-unknown-linux-musl/release/ktmpl +target/x86_64-unknown-linux-musl/release/ktmpl: docker run \ --rm \ - -v ${PWD}:/volume \ - -v ${HOME}/.cargo/git:/root/.cargo/git \ - -v ${HOME}/.cargo/registry:/root/.cargo/registry \ + -v $(PWD):/volume \ + -v $(HOME)/.cargo/git:/root/.cargo/git \ + -v $(HOME)/.cargo/registry:/root/.cargo/registry \ -w /volume \ -t \ clux/muslrust \ cargo build --release +.PHONY: docker-build docker-build: - docker build -t inquicker/ktmpl . + docker build -t inquicker/ktmpl -t inquicker/ktmpl:$(TAG) . + +dist: dist/sha256sums.txt.sig docker-build + +dist/ktmpl-$(TAG)-darwin.tar.gz: target/release/ktmpl + tar -c -C target/release -zvf dist/ktmpl-$(TAG)-darwin.tar.gz ktmpl + +dist/ktmpl-$(TAG)-linux.tar.gz: target/x86_64-unknown-linux-musl/release/ktmpl + tar -c -C target/x86_64-unknown-linux-musl/release -zvf dist/ktmpl-$(TAG)-linux.tar.gz ktmpl + +dist/sha256sums.txt: dist/ktmpl-$(TAG)-darwin.tar.gz dist/ktmpl-$(TAG)-linux.tar.gz + cd dist && shasum -a 256 * > sha256sums.txt + +dist/sha256sums.txt.sig: dist/sha256sums.txt + cd dist && gpg2 --detach-sign sha256sums.txt diff --git a/README.md b/README.md index ebf97c2..e82e60c 100644 --- a/README.md +++ b/README.md @@ -69,6 +69,14 @@ docker pull inquicker/ktmpl Make sure Cargo's bin directory is added to your PATH environment variable. +## Development + +To package the current release for distribution, update `TAG` in the Makefile and then run `make`. +Release artifacts will be written to the `dist` directory. +Docker images for `inquicker/ktmpl` and `inquicker/ktmpl:$TAG` will be created, but you must push +them manually. +Your GPG secret key will be required to sign `sha256sums.txt`. + ## Legal ktmpl is released under the MIT license. See `LICENSE` for details.