-
-
Notifications
You must be signed in to change notification settings - Fork 24
/
make-shards-release.sh
executable file
·39 lines (28 loc) · 1.06 KB
/
make-shards-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
#!/usr/bin/env sh
#
# This helper tags a new Shards release and publishes it to GitHub releases.
#
# Usage:
#
# scripts/make-shards-release.sh [VERSION]
#
# Requirements:
# * packages: git gh sed
# * Working directory should be in a checked out work tree of `crystal-lang/shards`.
#
# * The version is read from `src/VERSION`.
# * Tags current commit and pushes tag to GitHub.
# * Creates GitHub release for that tag with content from `CHANGELOG.md`.
set -eu
VERSION=$(cat VERSION | tr -d '\n')
. $(dirname $(realpath $0))/functions.sh
grep -q "version: $VERSION" shard.yml || abort "Missing version $VERSION in shard.yml"
tag=v$VERSION
step "Tag master commit as version ${tag}" git tag -s -a -m $tag $tag
git show
step "Push tag to GitHub" git push --tags
sed -E '3,/^## /!d' CHANGELOG.md | sed '$d' | sed -Ez 's/^\n+//; s/\n+$/\n/g' > CHANGELOG.$VERSION.md
echo "$ more CHANGELOG.$VERSION.md"
more CHANGELOG.$VERSION.md
step "Create GitHub release" gh release -R crystal-lang/shards create $tag --title $tag --notes-file CHANGELOG.$VERSION.md
rm CHANGELOG.$VERSION.md