Skip to content
This repository was archived by the owner on Jul 2, 2020. It is now read-only.

Commit 83ecd67

Browse files
committed
cleanup
1 parent c457d3f commit 83ecd67

File tree

2 files changed

+32
-18
lines changed

2 files changed

+32
-18
lines changed

.travis.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,12 @@ before_install:
44
- brew update
55
install:
66
- brew install msitools
7-
before_script:
8-
- echo $TRAVIS_TAG
97
script:
108
# Obtaining version from git tag, if it is not a git tag, set to 1.19.1 for testing
119
- if [[ ! -z "$TRAVIS_TAG" ]]; then version=$TRAVIS_TAG; else version=1.19.1; fi
1210
- VERSION=$version DEBUG=true ./pandocDownload2zip.sh
1311
after_success:
14-
- ls -l
12+
- ls -l dist
1513
deploy:
1614
provider: releases
1715
api_key: "$GH_TOKEN_SECURE"

pandocDownload2zip.sh

Lines changed: 31 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,29 +9,35 @@
99

1010
# debug msg
1111
if [[ "$DEBUG" == "true" ]]; then
12-
echo "$VERSION"
12+
echo "Processing pandoc version $VERSION"
1313
fi
1414

1515
# url to pandoc version
1616
url="https://github.com/jgm/pandoc/releases/tag/$VERSION"
1717
# debug msg
1818
if [[ "$DEBUG" == "true" ]]; then
19-
echo "$url"
19+
echo "Obtaining binaries from $url"
2020
fi
2121

2222
# get url to pandoc binaries
23-
debUrlPartial=$(curl -L "$url" | grep -o '/jgm/pandoc/releases/download/.*\.deb')
24-
pkgUrlPartial=$(curl -L "$url" | grep -o '/jgm/pandoc/releases/download/.*\.pkg')
25-
msiUrlPartial=$(curl -L "$url" | grep -o '/jgm/pandoc/releases/download/.*\.msi')
26-
zipUrlPartial=$(curl -L "$url" | grep -o '/jgm/pandoc/archive/.*\.zip')
27-
tarUrlPartial=$(curl -L "$url" | grep -o '/jgm/pandoc/archive/.*\.tar\.gz')
23+
html=$(curl -L --fail "$url")
24+
if [[ $? != 0 ]]; then
25+
echo "Cannot retrieve $url. Check if version $VERSION is valid."
26+
exit 1
27+
fi
28+
29+
debUrlPartial=$(printf '%s' "$html" | grep -o '/jgm/pandoc/releases/download/.*\.deb')
30+
pkgUrlPartial=$(printf '%s' "$html" | grep -o '/jgm/pandoc/releases/download/.*\.pkg')
31+
msiUrlPartial=$(printf '%s' "$html" | grep -o '/jgm/pandoc/releases/download/.*\.msi')
32+
zipUrlPartial=$(printf '%s' "$html" | grep -o '/jgm/pandoc/archive/.*\.zip')
33+
tarUrlPartial=$(printf '%s' "$html" | grep -o '/jgm/pandoc/archive/.*\.tar\.gz')
2834
# debug msg
2935
if [[ "$DEBUG" == "true" ]]; then
30-
echo "$debUrlPartial"
31-
echo "$pkgUrlPartial"
32-
echo "$msiUrlPartial"
33-
echo "$zipUrlPartial"
34-
echo "$tarUrlPartial"
36+
echo "URL to deb: $debUrlPartial"
37+
echo "URL to pkg: $pkgUrlPartial"
38+
echo "URL to msi: $msiUrlPartial"
39+
echo "URL to source code in zip: $zipUrlPartial"
40+
echo "URL to source code in tar.gz: $tarUrlPartial"
3541
fi
3642

3743
# prepare dist folder
@@ -56,6 +62,8 @@ if [[ ! -z "$debUrlPartial" ]]; then
5662
mv "$DEB" dist/
5763
mv "$debZip" dist/
5864
mv "$debWoExt.tar.gz" dist/
65+
else
66+
echo "deb package not found"
5967
fi
6068
## macOS
6169
if [[ ! -z "$pkgUrlPartial" ]]; then
@@ -78,6 +86,8 @@ if [[ ! -z "$pkgUrlPartial" ]]; then
7886
# to dist/
7987
mv "$PKG" dist/
8088
mv "$pkgZip" dist/
89+
else
90+
echo "pkg package not found"
8191
fi
8292
## Windows
8393
if [[ ! -z "$msiUrlPartial" ]]; then
@@ -95,6 +105,8 @@ if [[ ! -z "$msiUrlPartial" ]]; then
95105
# to dist/
96106
mv "$MSI" dist/
97107
mv "$msiZip" dist/
108+
else
109+
echo "msi package not found"
98110
fi
99111
## Source Code
100112
### .zip
@@ -104,8 +116,10 @@ if [[ ! -z "$zipUrlPartial" ]]; then
104116
ZIP="${zipUrl##*/}"
105117
# download
106118
wget "$zipUrl"
107-
# rename & to dist/
108-
mv "$ZIP" "dist/pandoc-source-code-$ZIP"
119+
# rename & to dist/
120+
mv "$ZIP" "dist/pandoc-source-code-$ZIP"
121+
else
122+
echo "source code not found in zip"
109123
fi
110124
### .tar.gz
111125
if [[ ! -z "$tarUrlPartial" ]]; then
@@ -114,6 +128,8 @@ if [[ ! -z "$tarUrlPartial" ]]; then
114128
TAR="${tarUrl##*/}"
115129
# download
116130
wget "$tarUrl"
117-
# rename & to dist/
131+
# rename & to dist/
118132
mv "$TAR" "dist/pandoc-source-code-$TAR"
133+
else
134+
echo "source code not found in tag.gz"
119135
fi

0 commit comments

Comments
 (0)