forked from mimblewimble/grin-miner
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.auto-release.sh
executable file
·75 lines (61 loc) · 2.68 KB
/
.auto-release.sh
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/bin/bash
repo_slug="mimblewimble/grin-miner"
token="$GITHUB_TOKEN"
tagname=`git describe --tags --exact-match 2>/dev/null || git symbolic-ref -q --short HEAD`
deploy_dir="deploy/grin-miner-$tagname"
echo 'make a tarball for the release binary...\n'
if [[ $TRAVIS_OS_NAME == 'osx' ]]; then
# Do some custom requirements on OS X
mkdir -p $deploy_dir; cp grin-miner.toml $deploy_dir; cp -R target/release/plugins $deploy_dir
cp target/release/grin-miner $deploy_dir
cd deploy ; rm -f *.tgz; tar zcf "grin-miner-$tagname-$TRAVIS_JOB_ID-osx.tgz" *
/bin/ls -ls *.tgz | awk '{print $6,$7,$8,$9,$10}'
md5 "grin-miner-$tagname-$TRAVIS_JOB_ID-osx.tgz" > "grin-miner-$tagname-$TRAVIS_JOB_ID-osx.tgz"-md5sum.txt
/bin/ls -ls *-md5sum.txt | awk '{print $6,$7,$8,$9,$10}'
cd - > /dev/null;
echo "tarball generated\n"
# Only generate changelog on Linux platform, to avoid duplication
exit 0
else
# Do some custom requirements on Linux
mkdir -p $deploy_dir; cp grin-miner.toml $deploy_dir; cp -R target/release/plugins $deploy_dir
cp target/release/deps/libocl_cuckatoo.so "$deploy_dir/plugins/ocl_cuckatoo.cuckooplugin"
cp target/release/deps/libocl_cuckaroo.so "$deploy_dir/plugins/ocl_cuckaroo.cuckooplugin"
cp target/release/grin-miner $deploy_dir
cd deploy ; rm -f *.tgz; tar zcf "grin-miner-$tagname-$TRAVIS_JOB_ID-linux-amd64.tgz" *
/bin/ls -ls *.tgz | awk '{print $6,$7,$8,$9,$10}'
md5sum "grin-miner-$tagname-$TRAVIS_JOB_ID-linux-amd64.tgz" > "grin-miner-$tagname-$TRAVIS_JOB_ID-linux-amd64.tgz"-md5sum.txt
/bin/ls -ls *-md5sum.txt | awk '{print $6,$7,$8,$9,$10}'
cd - > /dev/null;
echo "tarball generated\n"
fi
version="$tagname"
branch="`git symbolic-ref -q --short HEAD`"
# automatic changelog generator
gem install github_changelog_generator
LAST_REVISION=$(git rev-list --tags --skip=1 --max-count=1)
LAST_RELEASE_TAG=$(git describe --abbrev=0 --tags ${LAST_REVISION})
# Generate CHANGELOG.md
github_changelog_generator \
-u $(cut -d "/" -f1 <<< $repo_slug) \
-p $(cut -d "/" -f2 <<< $repo_slug) \
--token $token \
--since-tag ${LAST_RELEASE_TAG}
body="$(cat CHANGELOG.md)"
# Overwrite CHANGELOG.md with JSON data for GitHub API
jq -n \
--arg body "$body" \
--arg name "$version" \
--arg tag_name "$version" \
--arg target_commitish "$branch" \
'{
body: $body,
name: $name,
tag_name: $tag_name,
target_commitish: $target_commitish,
draft: false,
prerelease: false
}' > CHANGELOG.md
echo "Create release $version for repo: $repo_slug, branch: $branch"
curl -H "Authorization: token $token" --data @CHANGELOG.md "https://api.github.com/repos/$repo_slug/releases"
echo "auto changelog uploaded.\n"