mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-30 18:43:55 -07:00
Harmonize beta and assign true/false value, Capitalize print messages
This commit is contained in:
parent
fb74e8fd97
commit
b768c27c4c
1 changed files with 16 additions and 15 deletions
|
|
@ -7,7 +7,7 @@
|
|||
# adds output to GITHUB_OUTPUT
|
||||
template_path=".ci/release_template.md"
|
||||
body_path="/tmp/release.md"
|
||||
beta_regex='beta'
|
||||
beta_regex='-beta'
|
||||
name_regex='set\(GIT_TAG_RELEASENAME "([[:print:]]+)")'
|
||||
whitespace='^\s*$'
|
||||
|
||||
|
|
@ -23,28 +23,29 @@ fi
|
|||
|
||||
# create title
|
||||
if [[ $TAG =~ $beta_regex ]]; then
|
||||
echo "is_beta=true" >>"$GITHUB_OUTPUT"
|
||||
beta=true
|
||||
echo "beta=$beta" >>"$GITHUB_OUTPUT"
|
||||
title="$TAG"
|
||||
echo "creating beta release '$title'"
|
||||
echo "Creating beta release '$title'"
|
||||
elif [[ ! $(cat CMakeLists.txt) =~ $name_regex ]]; then
|
||||
echo "::error file=$0::could not find releasename in CMakeLists.txt"
|
||||
echo "::error file=$0::Could not find releasename in CMakeLists.txt"
|
||||
exit 1
|
||||
else
|
||||
echo "is_beta=false" >>"$GITHUB_OUTPUT"
|
||||
beta=false
|
||||
echo "beta=$beta" >>"$GITHUB_OUTPUT"
|
||||
name="${BASH_REMATCH[1]}"
|
||||
version="${TAG##*-}"
|
||||
title="Cockatrice $version: $name"
|
||||
no_beta=true
|
||||
echo "friendly_name=$name" >>"$GITHUB_OUTPUT"
|
||||
echo "creating full release '$title'"
|
||||
echo "Creating full release '$title'"
|
||||
fi
|
||||
echo "title=$title" >>"$GITHUB_OUTPUT"
|
||||
|
||||
# add release notes template
|
||||
if [[ $no_beta ]]; then
|
||||
if [[ $beta == "false" ]]; then
|
||||
body="$(cat "$template_path")"
|
||||
if [[ ! $body ]]; then
|
||||
echo "::warning file=$0::could not find release template"
|
||||
echo "::warning file=$0::Could not find release template"
|
||||
fi
|
||||
body="${body//--REPLACE-WITH-RELEASE-TITLE--/$title}"
|
||||
else
|
||||
|
|
@ -64,13 +65,13 @@ before="${all_tags%%
|
|||
"$TAG"*}" # strip line with current tag an all lines after it
|
||||
# note the extra newlines are needed to always have a last line
|
||||
if [[ $all_tags == "$before" ]]; then
|
||||
echo "::warning file=$0::could not find current tag"
|
||||
echo "::warning file=$0::Could not find current tag"
|
||||
else
|
||||
while
|
||||
previous="${before##*
|
||||
}" # get the last line
|
||||
# skip this tag if this is a full release and it's a beta or if empty
|
||||
[[ $no_beta && $previous =~ $beta_regex || ! $previous ]]
|
||||
[[ $beta == "false" && $previous =~ $beta_regex || ! $previous ]]
|
||||
do
|
||||
beta_list+=" $previous" # add to list of skipped betas
|
||||
next_before="${before%
|
||||
|
|
@ -85,7 +86,7 @@ else
|
|||
if generated_list="$(git log "$previous..$TAG" --pretty="- %s")"; then
|
||||
count="$(git rev-list --count "$previous..$TAG")"
|
||||
[[ $previous =~ $beta_regex ]] && previousreleasetype="beta release" || previousreleasetype="full release"
|
||||
echo "adding list of commits to release notes:"
|
||||
echo "Adding list of commits to release notes:"
|
||||
echo "'$previous' to '$TAG' ($count commits)"
|
||||
# --> is the markdown comment escape sequence, emojis are way better
|
||||
generated_list="${generated_list//-->/→}"
|
||||
|
|
@ -98,15 +99,15 @@ else
|
|||
if [[ $beta_list =~ $whitespace ]]; then
|
||||
beta_list="-n there are no betas to delete!"
|
||||
else
|
||||
echo "the following betas should be deleted after publishing:"
|
||||
echo "The following betas should be deleted after publishing:"
|
||||
echo "$beta_list"
|
||||
fi
|
||||
body="${body//--REPLACE-WITH-BETA-LIST--/$beta_list}"
|
||||
else
|
||||
echo "::warning file=$0::failed to produce git log"
|
||||
echo "::warning file=$0::Failed to produce git log"
|
||||
fi
|
||||
else
|
||||
echo "::warning file=$0::could not find previous tag"
|
||||
echo "::warning file=$0::Could not find previous tag"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue