Skip to content

Commit 1ebacd8

Browse files
committed
Automate release
#145
1 parent e9735d8 commit 1ebacd8

File tree

2 files changed

+68
-3
lines changed

2 files changed

+68
-3
lines changed

.travis.yml

Lines changed: 60 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,18 +158,75 @@ before_deploy:
158158
elif [[ "$TRAVIS_OS_NAME" = "osx" ]]; then
159159
stack clean --no-terminal
160160
stack build --no-terminal --copy-bins --flag nirum:static
161-
cp "$(stack path --local-bin-path)/nirum" "$NIGHTLY_BINARY_PATH"
161+
ls -al "$(stack path --local-bin)/nirum"
162+
mv "$(stack path --local-bin)/nirum" "$NIGHTLY_BINARY_PATH"
163+
# As of 2018-02-18, cp command in Travis CI's osx environment seems
164+
# somewhat broken; so use mv instead. See also:
165+
# https://github.com/travis-ci/travis-ci/issues/6307#issuecomment-363899104
162166
fi
167+
ls -al "$NIGHTLY_BINARY_PATH"
163168
164169
deploy:
170+
171+
# Nightly builds
165172
- provider: s3
173+
on: { branch: master, tags: yes }
174+
skip_cleanup: yes
166175
local_dir: /tmp/nirum-build
167-
on:
168-
branch: master
169176
upload-dir: travis-builds
170177
acl: public_read
171178
bucket: nightly-builds.nirum.org
172179
access_key_id:
173180
secure: "lqNHSWpskIWHBZdeUsT1LpUBnDv88vEdSwCX2vY+3hbspB2dEoeyxrQ3ObyHBvxizuxHC+wBKdCfpEUj9CuZTSZDuS0gbuks46IH5az5SmFFDRk/pq+5sSBte070YQfrJCEgFTiEww8LZCVjjySEqez0f1pQV4ZSmy8u8ME2PzF1jQdGZIUB/e3v7JAjhK3nKh2kt2YnEdscHngbmRaDkcpEmbia8fP9a9sRc9n4dG5m0/3vtuZJcUqrJzdqMfluwz9lOSWIjSCE3iClSrH0xrS1b4wIgEa2j5iHgayRwQ2MZN41+nhs+jG18FkSyHqdtZwLGZu8UdW7dQqIaPkk26yFBpHvKESJghh4HGKiijcVw4RNJmgJDpdmCrPU1awAvGdT8CXcbwr/9sqPfKgr1F79xn/7PDe6Nd3GXVRJRkV+g7GhSOCFcjBvEzbq4jmRI8Oo4GnyU0H3Kmgk2OyU0Yhq413cLEVcswyDBSjK+ItQQ/wQZgWL1+Vjh/MQbkESRpkRJK6Oq2y0nYhG/ajIXDuva623MNSaLU42/wku8r//bdbsguNEyncNzWcDwtfGBdyOD8GTLKtJD1tCSTH68b7isDjI/MDmCIay9hgCk/l8pBZgn89jLUDfiqH/ZgQduwKPYUUPUuBUv4YQg7bHeZk2NQSWWGsAfpZ5v9L1qUw="
174181
secret_access_key:
175182
secure: "HUxq2kPTnu3rSq+T7lZoUY4LsvIHjMcapxi5R50gE6pKUIJqJ6ekwB0fP6ge6S6ea3chpAi06oy7tGB4IiTtjUX6L+gOkrFACrWQqVsOvbyMh79oRTVPLY7RTXcDhSmSesChP06oxG2k17u7Agdf5jNfaVH8aOH4xAuBaAYWPTqkIwerGqQHj7oHUGImtu0FDS1ZxL28XiGjONoT2cpoaYT5pzV8KlETe5+ZAr/mxQYHgxt8wzev0pJY6UeBPARiPa1+txEK36AMrHEQHMInZcqgds05T0qX+UF326xlLuFP7soYGRh+mfnvCEx3+hcneX8wJYbaUwpmDrbcCcm91+TUlEWWV3xIXmGHedi0pIvgzH7vapOdzox6MpHGoLJsrRXpHEhMwLMcq0tMbyjcTQjOba2VKRg8hqUBT57oI9Hgpp8wdFnH5EV5GPSOhZ5s4w+PglifEqtqmYHA7PNc5I5iHLXC85UKee+FMQF7hp4heLVQZx541FL7eMYZo2bTOyxTEGMjoxemwN5yHPQ33k7VOKvYLHNX0SxasQme8DwOZbj1ozsWdSPqyArisW0CqXyjFpIm5hPx+gBH1gRXp0hJoyYRBKTrfTxPzFsO5Sf0VfDJC/1UZmzgNULjFdZUdv9/x7O4+Euo1wy/kcngmYbOqqBD3zKm8XcDqwkoAA4="
183+
184+
# GitHub Releases
185+
- provider: releases
186+
on: { tags: yes }
187+
skip_cleanup: yes
188+
api_key: "$GITHUB_TOKEN"
189+
file_glob: yes
190+
file: /tmp/nirum-build/*
191+
name: "$TRAVIS_TAG"
192+
193+
after_deploy: |
194+
[[ "$TRAVIS_TAG" != "" && "$TRAVIS_OS_NAME" = "linux" ]] || exit 0
195+
196+
# Give the GitHub release a proper description
197+
export GITHUB_USER="${TRAVIS_REPO_SLUG%%/[^/]*}" \
198+
GITHUB_REPO="${TRAVIS_REPO_SLUG#[^/]*/}"
199+
curl -L -o "$HOME/.local/bin/submark" \
200+
https://github.com/dahlia/submark/releases/download/0.2.0/submark-linux-x86_64
201+
chmod +x "$HOME/.local/bin/submark"
202+
submark -o /tmp/release-note -i --h2 "Version $TRAVIS_TAG" -O CHANGES.md
203+
pushd /tmp
204+
curl -LO \
205+
https://github.com/aktau/github-release/releases/download/v0.7.2/linux-amd64-github-release.tar.bz2
206+
tar xvfj linux-amd64-github-release.tar.bz2
207+
mv bin/linux/amd64/github-release "$HOME/.local/bin"
208+
if [[ "$TRAVIS_TAG" = 0.* ]]; then
209+
pre_release="--pre-release"
210+
fi
211+
github-release edit \
212+
--tag "$TRAVIS_TAG" \
213+
--name "Nirum $TRAVIS_TAG" \
214+
--description "$(cat /tmp/release-note)" \
215+
$pre_release
216+
popd
217+
218+
# Hackage
219+
mkdir -p "$HOME/.stack/upload"
220+
python -c 'import json, os; print(json.dumps({"username": os.environ["HACKAGE_USERNAME"], "password": os.environ["HACKAGE_PASSWORD"]}))' > ~/.stack/upload/credentials.json
221+
sed -i 's/^- -Werror$//g' package.yaml # Hackage disallows -Werror
222+
stack --no-terminal sdist --ignore-check
223+
stack --no-terminal upload --ignore-check --no-signature .
224+
225+
# Upload sdist as well to GitHub Releases
226+
for sdist_file in "$(stack path --dist-dir)"/*.tar.gz; do
227+
github-upload upload \
228+
--tag "$TRAVIS_TAG" \
229+
--name "$(basename $sdist_file)" \
230+
--label "Gzipped source tarball" \
231+
--file "$sdist_file"
232+
done

appveyor.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,11 @@ test_script:
6363
artifacts:
6464
- path: nirum-win-x86.exe
6565
- path: nirum-win-x64.exe
66+
deploy:
67+
provider: GitHub
68+
on: { appveyor_repo_tag: true }
69+
auth_token:
70+
secure: FsK3lwqFkPdtwzbjZ8a4gLn1GOT74D9TqBvKveEwFB7hL6pEp/d7cNUTpy91JGGt
71+
release: "$(appveyor_repo_tag_name)"
72+
description: "$(appveyor_repo_tag_name)"
73+
artifact: /.*\.exe/

0 commit comments

Comments
 (0)