Skip to content

Commit

Permalink
Add distribution targets to Makefile.
Browse files Browse the repository at this point in the history
  • Loading branch information
jimmycuadra committed May 13, 2016
1 parent c5520cb commit a261b89
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 7 deletions.
1 change: 0 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@ FROM scratch
ENTRYPOINT ["/ktmpl"]

COPY target/x86_64-unknown-linux-musl/release/ktmpl /ktmpl

34 changes: 28 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

0 comments on commit a261b89

Please sign in to comment.