Set up Travis integrations for shipping binaries
This commit is contained in:
parent
31bd3d4061
commit
bbc449f457
21
.travis.yml
Normal file
21
.travis.yml
Normal file
@ -0,0 +1,21 @@
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- libgmp-dev
|
||||
after_success:
|
||||
- sh tools/attach-binary.sh
|
||||
before_install:
|
||||
- sh tools/install-stack.sh
|
||||
- sh tools/install-github-release.sh
|
||||
cache:
|
||||
directories:
|
||||
- $HOME/.local/bin
|
||||
- $HOME/.stack
|
||||
os:
|
||||
- linux
|
||||
- osx
|
||||
script:
|
||||
- stack setup
|
||||
- stack build --ghc-options -O2 --pedantic
|
||||
sudo: false
|
||||
|
6
examples/gitprofile.md
Executable file
6
examples/gitprofile.md
Executable file
@ -0,0 +1,6 @@
|
||||
#!/Users/chris/.local/bin/tempered
|
||||
Chris's github account has {{
|
||||
account_info=`curl https://api.github.com/users/chrispenner`
|
||||
followers=`json followers << $account_info`
|
||||
echo $account_info | json followers }} followers!
|
||||
|
@ -1,5 +1,5 @@
|
||||
name: tempered
|
||||
version: 0.1.0.0
|
||||
version: 0.1.0
|
||||
synopsis: A dead-simple shell interpolation templating utility
|
||||
-- description: A dead-simple shell interpolation templating utility
|
||||
homepage: https://github.com/ChrisPenner/tempered#readme
|
||||
|
24
tools/attach-binary.sh
Normal file
24
tools/attach-binary.sh
Normal file
@ -0,0 +1,24 @@
|
||||
set -o errexit -o verbose
|
||||
|
||||
if test ! "$TRAVIS_TAG"
|
||||
then
|
||||
echo 'This is not a release build.'
|
||||
elif test ! "$GITHUB_TOKEN"
|
||||
then
|
||||
echo 'The GITHUB_TOKEN environment variable is not set!'
|
||||
exit 1
|
||||
else
|
||||
echo "Attaching binary for $TRAVIS_OS_NAME to $TRAVIS_TAG..."
|
||||
BIN="$(stack path --local-install-root)/bin/tempered"
|
||||
chmod +x "$BIN"
|
||||
gzip --best --to-stdout "$BIN" > tempered.gz
|
||||
echo "SHA256:"
|
||||
shasum -a 256 tempered.gz
|
||||
github-release upload \
|
||||
--token "$GITHUB_TOKEN" \
|
||||
--owner ChrisPenner \
|
||||
--repo tempered \
|
||||
--tag "$TRAVIS_TAG" \
|
||||
--file tempered.gz \
|
||||
--name "tempered-$TRAVIS_TAG-$TRAVIS_OS_NAME.gz"
|
||||
fi
|
17
tools/install-github-release.sh
Normal file
17
tools/install-github-release.sh
Normal file
@ -0,0 +1,17 @@
|
||||
set -o errexit -o verbose
|
||||
|
||||
if test -f "$HOME/.local/bin/github-release"
|
||||
then
|
||||
echo 'GitHub Release is already installed.'
|
||||
else
|
||||
echo "Installing GitHub Release for $TRAVIS_OS_NAME..."
|
||||
V='0.1.9'
|
||||
URL="https://github.com/tfausak/github-release/releases/download/$V/github-release-$V-$TRAVIS_OS_NAME.gz"
|
||||
curl --location "$URL" > github-release.gz
|
||||
gunzip github-release.gz
|
||||
chmod u+x github-release
|
||||
mkdir -p "$HOME/.local/bin"
|
||||
mv github-release "$HOME/.local/bin/"
|
||||
fi
|
||||
|
||||
github-release version
|
17
tools/install-stack.sh
Normal file
17
tools/install-stack.sh
Normal file
@ -0,0 +1,17 @@
|
||||
set -o errexit -o verbose
|
||||
|
||||
if test -f "$HOME/.local/bin/stack"
|
||||
then
|
||||
echo 'Stack is already installed.'
|
||||
else
|
||||
echo "Installing Stack for $TRAVIS_OS_NAME..."
|
||||
URL="https://www.stackage.org/stack/$TRAVIS_OS_NAME-x86_64"
|
||||
curl --location "$URL" > stack.tar.gz
|
||||
gunzip stack.tar.gz
|
||||
tar -x -f stack.tar --strip-components 1
|
||||
mkdir -p "$HOME/.local/bin"
|
||||
mv stack "$HOME/.local/bin/"
|
||||
rm stack.tar
|
||||
fi
|
||||
|
||||
stack --version
|
Loading…
x
Reference in New Issue
Block a user