diff --git a/.travis.yml b/.travis.yml index 96ea3a6..049291a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,3 +17,34 @@ env: - BUILD=dub script: ./.travis.sh + +jobs: + include: + - stage: GitHub Release + if: tag IS present + d: ldc + os: linux + script: echo "Deploying to GitHub releases ..." && make release + deploy: + provider: releases + api_key: $GH_REPO_TOKEN + file_glob: true + file: bin/dcd-*.tar.gz + skip_cleanup: true + on: + repo: dlang-community/dcd + tags: true + - stage: GitHub Release + if: tag IS present + d: ldc + os: osx + script: echo "Deploying to GitHub releases ..." && make release + deploy: + provider: releases + api_key: $GH_REPO_TOKEN + file_glob: true + file: bin/dcd-*.tar.gz + skip_cleanup: true + on: + repo: dlang-community/dcd + tags: true diff --git a/makefile b/makefile index df5e3fb..955f467 100644 --- a/makefile +++ b/makefile @@ -14,6 +14,8 @@ DPARSE_DIR := libdparse DSYMBOL_DIR := dsymbol STDXALLOC_DIR := stdx-allocator +SHELL:=/bin/bash + githash: git log -1 --format="%H" > githash.txt @@ -147,3 +149,28 @@ ldcserver: githash test: debugserver dmdclient cd tests && ./run_tests.sh + +.ONESHELL: +release: + @set -eux -o pipefail + VERSION=$$(git describe --abbrev=0 --tags) + ARCH="$${ARCH:-64}" + unameOut="$$(uname -s)" + case "$$unameOut" in + Linux*) OS=linux; ;; + Darwin*) OS=osx; ;; + *) echo "Unknown OS: $$unameOut"; exit 1 + esac + + case "$$ARCH" in + 64) ARCH_SUFFIX="x86_64";; + 32) ARCH_SUFFIX="x86";; + *) echo "Unknown ARCH: $$ARCH"; exit 1 + esac + + archiveName="dcd-$$VERSION-$$OS-$$ARCH_SUFFIX.tar.gz" + + echo "Building $$archiveName" + ${MAKE} ldcclient + ${MAKE} ldcserver + tar cvfz "bin/$$archiveName" -C bin dcd-client dcd-server