File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- #! /bin/bash
2- echo " >> elgohr/Github-Release-Action@master is deprecated!"
3- echo " >> Please switch to elgohr/Github-Release-Action@v4"
1+ #! /usr/bin/env bash
2+ set -Eeuo pipefail
43
5- MESSAGE=$*
6- hub release create -m ${MESSAGE} $( date +%Y%m%d%H%M%S)
4+ if [ -z " ${GITHUB_TOKEN:- } " ]; then
5+ if [ -n " $INPUT_TOKEN " ]; then
6+ export GITHUB_TOKEN=" $INPUT_TOKEN "
7+ else
8+ echo " The token input is not set!" && exit 1
9+ fi
10+ fi
11+
12+ [ -z " $INPUT_TITLE " ] && INPUT_TITLE=" Name"
13+ INPUT_TITLE=" $( echo " $INPUT_TITLE " | tr -d ' ' ) "
14+ [ -z " $INPUT_TAG " ] && INPUT_TAG=" $( date +%Y%m%d%H%M%S) "
15+
16+ { gh release view " $INPUT_TAG " > /dev/null 2>&1 ; rc=$? ; } || :
17+
18+ if (( rc == 0 )) ; then
19+ echo " Release tag $INPUT_TAG does already exists, it will be replaced..."
20+ gh release delete " $INPUT_TAG " --cleanup-tag --yes
21+ sleep 3
22+ fi
23+
24+ if [ -z " $INPUT_COMMIT " ]; then
25+ if [ -z " $INPUT_BODY " ]; then
26+ gh release create -t " $INPUT_TITLE " " $INPUT_TAG " --generate-notes
27+ else
28+ gh release create -t " $INPUT_TITLE " -n " $INPUT_BODY " " $INPUT_TAG "
29+ fi
30+ else
31+ if [ -z " $INPUT_BODY " ]; then
32+ gh release create --target " $INPUT_COMMIT " -t " $INPUT_TITLE " " $INPUT_TAG " --generate-notes
33+ else
34+ gh release create --target " $INPUT_COMMIT " -t " $INPUT_TITLE " -n " $INPUT_BODY " " $INPUT_TAG "
35+ fi
36+ fi
You can’t perform that action at this time.
0 commit comments