Trying to autoplublish releases

This commit is contained in:
Syrus Akbary 2018-11-13 10:28:50 -08:00
parent 3e5b3b1838
commit 36f46342bc
3 changed files with 108 additions and 2 deletions

View File

@ -12,11 +12,61 @@ jobs:
- run: sudo apt-get install -y cmake
- run: rustup default nightly-2018-10-07
- run: make test
- run:
command: |
make release
mkdir -p artifacts
cp ./target/release/wasmer ./artifacts/$(./binary-name.sh)
- persist_to_workspace:
root: .
paths:
- artifacts
- save_cache:
paths:
- /usr/local/cargo/registry
- target/debug/.fingerprint
- target/debug/build
- target/debug/deps
- target/release/build
- target/release/deps
key: v4-cargo-cache-{{ arch }}-{{ checksum "Cargo.lock" }}
# create-release-artifacts-mac:
# macos:
# xcode: "9.0"
# - checkout
publish-github-release:
docker:
- image: cibuilds/github
steps:
- attach_workspace:
at: .
- run:
name: "Publish Release on GitHub"
command: |
# go get github.com/tcnksm/ghr
# VERSION=$(git log -1 --pretty=%B)
VERSION=$(cargo pkgid | cut -d# -f2 | cut -d: -f2)
# VERSION=${CIRCLE_TAG}
# VERSION=$(./artifacts/ --version)
ghr -t ${GITHUB_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} -delete ${VERSION} ./artifacts/
workflows:
version: 2
main:
jobs:
- build
# :
# filters:
# tags:
# only: /^\d+\.\d+\.\d+$/
- publish-github-release:
requires:
- build
# filters:
# branches:
# ignore: /.*/
# tags:
# only: /^\d+\.\d+\.\d+$/

View File

@ -5,7 +5,7 @@ spectests:
WASM_GENERATE_SPECTESTS=1 cargo build
# clean:
# rm -rf target
# rm -rf artifacts
build:
cargo build
@ -15,3 +15,15 @@ install:
test:
cargo test -- --test-threads=1
release:
# If you are in OS-X, you will need mingw-w64 for cross compiling to windows
# brew install mingw-w64
cargo build --release
# mkdir -p artifacts
# BINARY_NAME := $(./binary-name.sh)
# cp ./target/release/wasmer ./artifacts/$(./binary-name.sh)
# cp ./target/release/wasmer ./artifacts/${BINARY_NAME}
publish-release:
ghr -t ${GITHUB_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} -delete ${VERSION} ./artifacts/

44
binary-name.sh Executable file
View File

@ -0,0 +1,44 @@
#!/bin/sh
initArch() {
ARCH=$(uname -m)
if [ -n "$WASMER_ARCH" ]; then
ARCH="$WASMER_ARCH"
fi
case $ARCH in
amd64) ARCH="amd64";;
x86_64) ARCH="amd64";;
i386) ARCH="386";;
*) echo "Architecture ${ARCH} is not supported by this installation script"; exit 1;;
esac
}
initOS() {
OS=$(uname | tr '[:upper:]' '[:lower:]')
if [ -n "$WASMER_OS" ]; then
echo "Using WASMER_OS"
OS="$WASMER_OS"
fi
case "$OS" in
darwin) OS='darwin';;
linux) OS='linux';;
freebsd) OS='freebsd';;
mingw*) OS='windows';;
msys*) OS='windows';;
*) echo "OS ${OS} is not supported by this installation script"; exit 1;;
esac
}
# identify platform based on uname output
initArch
initOS
# determine install directory if required
BINARY="wasmer-${OS}-${ARCH}"
# add .exe if on windows
if [ "$OS" = "windows" ]; then
BINARY="$BINARY.exe"
fi
echo "${BINARY}"