Skip to content

Commit bb87fa0

Browse files
committed
improve release scripts
1 parent 1976fc4 commit bb87fa0

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

prepare.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ git add .
4343
git commit -m "build v$MAJOR.$MINOR.$PATCH" || true
4444
git push origin "releases/v$MAJOR"
4545
gh release create "v$MAJOR.$MINOR.$PATCH" \
46-
--draft --target "$(git rev-parse HEAD)" --title "v$MAJOR.$MINOR.$PATCH" --notes ""
46+
--draft --target "$(git rev-parse HEAD)" --title "v$MAJOR.$MINOR.$PATCH" --generate-notes
4747

4848
cd "$CURRENT"
4949
rm -rf "$WORKING"

release.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,10 @@ MINOR=$(echo "$VERSION" | cut -d. -f2)
2323
PATCH=$(echo "$VERSION" | cut -d. -f3)
2424
WORKING=$CURRENT/.working
2525

26-
: release the action
27-
if ! RELEASE=$(gh release view "v$MAJOR.$MINOR.$PATCH" --json url,targetCommitish); then
26+
cd "$CURRENT"
27+
28+
: check whether the release is already created.
29+
if ! RELEASE=$(gh release view "v$MAJOR.$MINOR.$PATCH" --json url,targetCommitish,apiUrl); then
2830
: it looks that "v$MAJOR.$MINOR.$PATCH" is not tagged.
2931
: run ./prepare.sh "v$MAJOR.$MINOR.$PATCH" at first.
3032
: see the comments of ./release.sh for more details.
@@ -37,6 +39,10 @@ rm -rf "$WORKING"
3739
git clone "$ORIGIN" "$WORKING"
3840
cd "$WORKING"
3941

42+
: make a draft release public.
43+
echo '{"draft":false}' | gh api -X PATCH --input - "$(echo "$RELEASE" | jq '.apiUrl')" --jq '.html_url'
44+
45+
: make a tag.
4046
git checkout "$(echo "$RELEASE" | jq -r .targetCommitish)"
4147
git tag -sfa "v$MAJOR" -m "release v$MAJOR.$MINOR.$PATCH"
4248
git push -f origin "v$MAJOR"

0 commit comments

Comments
 (0)