X Tutup
Skip to content
This repository was archived by the owner on Mar 7, 2025. It is now read-only.

Commit e398735

Browse files
committed
Changelog: Added release.sh script
1 parent c10602c commit e398735

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

scripts/release.sh

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#!/usr/bin/env bash
2+
3+
################################
4+
# Variables
5+
################################
6+
7+
readonly CHANGELOG="changelog.txt"
8+
readonly DATE=$(date +"%Y-%m-%d")
9+
readonly REPO="cloudbox/cloudbox"
10+
readonly TAG=$(git describe --abbrev=0 --tags \
11+
| awk -F. -v OFS=. 'NF==1{print ++$NF}; NF>1{$NF=sprintf("%0*d", length($NF), ($NF+1)); print}')
12+
13+
################################
14+
# Main
15+
################################
16+
17+
set -e
18+
[ -z "$DEBUG" ] || set -x;
19+
20+
NAME="${TAG}"
21+
22+
BODY=$(bash scripts/changelog.sh -s)
23+
24+
payload=$(
25+
jq --null-input \
26+
--arg tag "$TAG" \
27+
--arg name "$TAG" \
28+
--arg body "$BODY" \
29+
'{ tag_name: $tag, name: $name, body: $body, draft: true }'
30+
)
31+
32+
response=$(
33+
curl --fail \
34+
--netrc \
35+
--silent \
36+
--location \
37+
--data "$payload" \
38+
"https://api.github.com/repos/${REPO}/releases"
39+
)
40+
41+
upload_url="$(echo "$response" | jq -r .upload_url | sed -e "s/{?name,label}//")"
42+
43+
44+
# Modifications by desimaniac @ github.com
45+
#
46+
# Source:
47+
# https://gist.github.com/foca/38d82e93e32610f5241709f8d5720156
48+
# Copyright (c) 2016 Nicolas Sanguinetti <hi@nicolassanguinetti.info>

0 commit comments

Comments
 (0)
X Tutup