-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathdeploy
More file actions
executable file
·46 lines (38 loc) · 842 Bytes
/
deploy
File metadata and controls
executable file
·46 lines (38 loc) · 842 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/bash
# Script for deploying the package via Travis CI
# Use --dry-run for testing without uploading anything
set -euo pipefail
DRY_RUN=
while [ $# -gt 0 ]
do
case "$1" in
--dry-run)
DRY_RUN=true
shift
;;
*)
shift
;;
esac
done
function report_fail() {
echo $1 >&2
exit 1
}
# Test releasing
stack sdist || report_fail "Failed to package for Hackage."
npm install
npm publish --dry-run || report_fail "Failed to package for NPM."
if [ -z "$DRY_RUN" ]
then
# Release to Hackage via Stack
stack upload . || report_fail "Failed to upload to Hackage."
# Release to NPM
NPMRC=$HOME/.npmrc
if [ ! -f "$NPMRC" ]
then
echo '//registry.npmjs.org/:_authToken='"$NPM_TOKEN" > "$NPMRC"
chmod go-rwx "$NPMRC"
fi
npm publish || report_fail "Failed to upload to NPM."
fi