-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
entrypoint.sh
executable file
·30 lines (26 loc) · 934 Bytes
/
entrypoint.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
#!/bin/sh
set -e
# Read next version from CHANGLOG
next_version_heading=$(changelog latest --filename CHANGELOG.md)
next_version=${next_version_heading/v}
next_version=$([[ "$next_version" == There* ]] && (echo $next_version && exit 1) || echo $next_version)
echo "Next version: '$next_version'"
# Get release notes from CHANGELOG
body=$(changelog show "$next_version_heading")
# Disable warnings about dubious ownership
# We only really need to know the current head.
git config --global --add safe.directory '*'
# Create GitHub Release
sha=$(git rev-parse HEAD)
echo "Release sha: $sha"
jq -n -r \
--arg sha $sha \
--arg body "$body" \
--arg name v$next_version \
'{ tag_name: $name, target_commitish: $sha, body: $body, name: $name }' \
| curl \
-X POST \
-H "Authorization: token $1" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/$GITHUB_REPOSITORY/releases \
-d @-