diff --git a/scripts/prepare-build.sh b/scripts/prepare-build.sh new file mode 100755 index 0000000..1021228 --- /dev/null +++ b/scripts/prepare-build.sh @@ -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 \ No newline at end of file diff --git a/scripts/publish.sh b/scripts/publish.sh index 90cfd5c..f41419c 100755 --- a/scripts/publish.sh +++ b/scripts/publish.sh @@ -8,15 +8,8 @@ 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="" @@ -24,9 +17,8 @@ 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 } @@ -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 @@ -77,5 +68,6 @@ if [[ $VERSION =~ $VERSION_REGEX ]]; then github_release else + build_channels echo "Missing or invalid version. Publish skipped." fi