Skip to content

Commit

Permalink
update publish script
Browse files Browse the repository at this point in the history
  • Loading branch information
myin142 committed Aug 5, 2023
1 parent 96e3978 commit 0f06322
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 14 deletions.
21 changes: 21 additions & 0 deletions scripts/prepare-build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/sh

CLIENT_VERSION=$1

# Use the Git hash if no CLIENT_VERSION is given.
if [ -z "$CLIENT_VERSION" ]; then
# GitLab CI:
if [ -n "$CI_COMMIT_SHA" ]; then
CLIENT_VERSION="$CI_COMMIT_SHA"

# GitHub Actions:
elif [ -n "$GITHUB_SHA" ]; then
CLIENT_VERSION="$GITHUB_SHA"
fi
fi

cat << EOF > godot/addons/debug/Build.gd
class_name Build
const VERSION = '$CLIENT_VERSION'
EOF
20 changes: 6 additions & 14 deletions scripts/publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,17 @@
GAME="##VAR_GAME_NAME"
VERSION="$1"

ARGS=("$@")
if [[ ${#ARGS[@]} -lt 2 ]]; then
echo "No channels"
exit 0
fi
shift

# win, linux, Web, macOS, android
CHANNELS=( "$@" )
# win, linux, web, macOS, android
CHANNELS=("web" "linux" "win" "macOS")
LAST_TAG=$(git describe --tags --abbrev=0)
CHANGELOG=""

generate_changelog() {
echo "Generating changelog"
touch package.json
echo "{}" > package.json
changelog -p -t $LAST_TAG -f CHANGELOG.md
changelog -t $LAST_TAG -f CHANGELOG.md
CHANGELOG=$(cat CHANGELOG.md)
rm package.json
rm CHANGELOG.md
}

Expand Down Expand Up @@ -63,11 +55,10 @@ itch_release() {
done
}

# sh ./addons/debug/prepare-build.sh $VERSION
build_channels

VERSION_REGEX='^v[0-9]+\.[0-9]+\.[0-9]+(-rc[0-9]+)?$'
if [[ $VERSION =~ $VERSION_REGEX ]]; then
sh ./scripts/prepare-build.sh $VERSION
build_channels
generate_changelog

if [[ $VERSION != *"-rc"* ]]; then
Expand All @@ -77,5 +68,6 @@ if [[ $VERSION =~ $VERSION_REGEX ]]; then
github_release

else
build_channels
echo "Missing or invalid version. Publish skipped."
fi

0 comments on commit 0f06322

Please sign in to comment.