Skip to content

Commit

Permalink
v0.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
adil192 committed Aug 9, 2023
1 parent ac6e7ca commit 4743b48
Show file tree
Hide file tree
Showing 7 changed files with 169 additions and 7 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@
Ricochlime is a game where you attack the advancing slimes with your ricocheting projectiles. The game is made with the [Flame](https://flame-engine.org/) game engine and [Flutter](https://flutter.dev/).

<img src='https://github.com/adil192/ricochlime/blob/main/metadata/en-US/images/tenInchScreenshots/game.png' alt='Game screen with a player at the bottom facing multiple slimes' />

[download_windows]: https://github.com/adil192/ricochlime/releases/download/v0.1.0/RicochlimeInstaller_v0.1.0.exe
[download_appimage]: https://github.com/adil192/ricochlime/releases/download/v0.1.0/Ricochlime-0.1.0-x86_64.AppImage
8 changes: 7 additions & 1 deletion flatpak/com.adilhanney.ricochlime.metainfo.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@
</screenshots>

<releases>

<release version="0.1.0" type="development" date="2023-08-09">
<description>
<ul>
<li>Initial release</li>
</ul>
</description>
</release>
</releases>
</component>
2 changes: 1 addition & 1 deletion installers/desktop_inno_script.iss
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

#define MyAppName "Ricochlime"
#define MyAppVersion "0.7.4"
#define MyAppVersion "0.1.0"
#define MyAppPublisher "Adil Hanney"
#define MyAppURL "https://github.com/adil192/ricochlime"
#define MyAppExeName "ricochlime.exe"
Expand Down
1 change: 1 addition & 0 deletions metadata/en-US/changelogs/1000.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
• Initial release
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
version: 1.0.0+1
version: 0.1.0+1000

environment:
sdk: '>=3.0.6 <4.0.0'
Expand Down
152 changes: 152 additions & 0 deletions scripts/apply_version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
#!/usr/bin/env bash

# Fixes 'grep: -P supports only unibyte and UTF-8 locales'
# for Git Bash on Windows
export LC_ALL=en_US.utf8

if [[ "$OSTYPE" == "darwin"* ]]; then
# Use GNU grep on macOS
# brew install grep gnu-sed gawk
PATH="/usr/local/opt/grep/libexec/gnubin:$PATH"
PATH="/usr/local/opt/gnu-sed/libexec/gnubin:$PATH"
PATH="/usr/local/opt/gawk/libexec/gnubin:$PATH"
fi

# Path to an editor executable with which to open
# the files you need to manually edit.
#
# E.g. if you are using VS Code, you can set this to
# EDITOR=$(which code)
#
# If you leave this empty, the script will not open any files.
# This is the same as using the -q flag.
EDITOR=$(which code)

# get the current version name from pubspec.yaml (the part before the +)
function get_version_name {
grep -oP '(?<=version: ).*(?=\+)' pubspec.yaml
}

# get the current version code from pubspec.yaml (the part after the +)
function get_version_code {
grep -oP '(?<=version: ).*' pubspec.yaml | grep -oP '(?<=\+).*$'
}

function print_help {
echo "This script is used to apply the version to the relevant files."
echo "Usage: $0 <version-name> <version-code> [-q]"
echo "e.g. $0 $(get_version_name) $(get_version_code)"

echo
echo "Options:"
echo " -q: Quiet mode. Doesn't automatically open files that need to be manually edited."

exit 0
}

# help
if [ "$1" == "-h" ] || [ "$1" == "--help" ] || [ "$1" == "" ]; then
print_help
fi

# check if we have 2-3 arguments
if [ "$#" -lt 2 ] || [ "$#" -gt 3 ]; then
print_help
fi

DUMMY_CHANGELOG="Release notes will be added here"
BUILD_NAME=$1
BUILD_NUMBER=$2
DATE=$(date +%Y-%m-%d)
YEAR=$(date +%Y)

# -q flag
if [ "$3" == "-q" ]; then
EDITOR=""
elif [ "$3" != "" ]; then
print_help
fi

# Check if the editor exists
if [ "$EDITOR" != "" ] && [ ! -f "$EDITOR" ]; then
echo "Editor not found: $EDITOR"
echo "Please set the EDITOR variable in this script to the path of your editor executable,"
echo "or use the -q flag to not open any files."
exit 1
fi

# check if the build name is valid
if [[ ! $BUILD_NAME =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Invalid build name: $BUILD_NAME"
exit 1
fi

# check if the build number is valid
if [[ ! $BUILD_NUMBER =~ ^[0-9]+$ ]]; then
echo "Invalid build number: $BUILD_NUMBER"
exit 1
fi

echo "Applying version $BUILD_NAME ($BUILD_NUMBER) ($DATE) to the relevant files..."

echo " - Updating MyAppVersion in installers/desktop_inno_script.iss" # e.g. #define MyAppVersion "0.5.5"
sed -i "s/#define MyAppVersion .*/#define MyAppVersion \"$BUILD_NAME\"/g" installers/desktop_inno_script.iss

echo " - Updating version in pubspec.yaml" # e.g. version: 5.5.0+5050
sed -i "s/version: .*/version: $BUILD_NAME+$BUILD_NUMBER/g" pubspec.yaml

echo " - Updating VERSION_AS_NUMBER in windows/runner/Runner.rc" # e.g. #define VERSION_AS_NUMBER 0,5,5,0
BUILD_NAME_WITH_COMMAS=${BUILD_NAME//./,}
sed -i "s/#define VERSION_AS_NUMBER .*/#define VERSION_AS_NUMBER $BUILD_NAME_WITH_COMMAS,0/g" windows/runner/Runner.rc

echo " - Updating VERSION_AS_STRING in windows/runner/Runner.rc" # e.g. #define VERSION_AS_STRING "0.5.5.0"
sed -i "s/#define VERSION_AS_STRING .*/#define VERSION_AS_STRING \"$BUILD_NAME.0\"/g" windows/runner/Runner.rc

echo " - Updating Windows download link in README.md"
# e.g. [download_windows]: https://github.com/adil192/ricochlime/releases/download/v0.11.0/RicochlimeInstaller_v0.11.0.exe
sed -i "s|\[download_windows\]: .*|\[download_windows\]: https://github.com/adil192/ricochlime/releases/download/v${BUILD_NAME}/RicochlimeInstaller_v${BUILD_NAME}.exe|g" README.md

echo " - Updating AppImage download link in README.md"
# e.g. [download_appimage]: https://github.com/adil192/ricochlime/releases/download/v0.11.0/Ricochlime-0.11.0-x86_64.AppImage
sed -i "s|\[download_appimage\]: .*|\[download_appimage\]: https://github.com/adil192/ricochlime/releases/download/v${BUILD_NAME}/Ricochlime-${BUILD_NAME}-x86_64.AppImage|g" README.md

echo

CHANGELOG_FILE="metadata/en-US/changelogs/$BUILD_NUMBER.txt"
if [ -f "$CHANGELOG_FILE" ]; then
echo " - Changelog file already exists at $CHANGELOG_FILE"
else
echo " - (*) Creating a blank changelog file at $CHANGELOG_FILE"
echo "$DUMMY_CHANGELOG" > "$CHANGELOG_FILE"
fi

FLATPAK_FILE="flatpak/com.adilhanney.ricochlime.metainfo.xml"
if grep -q "$BUILD_NAME" "$FLATPAK_FILE"; then
echo " - <release> tag already exists in $FLATPAK_FILE"
else
echo " - (*) Adding <release> tag to $FLATPAK_FILE"
# shellcheck disable=SC1078,SC1079
RELEASE_TAG="""\
<release version=\"$BUILD_NAME\" type=\"development\" date=\"$DATE\">
<description>
<ul>
<li>$DUMMY_CHANGELOG</li>
</ul>
</description>
</release>\
"""
awk -v release="$RELEASE_TAG" 'NR==55{print release}1' "$FLATPAK_FILE" > "${FLATPAK_FILE}.tmp"
mv "${FLATPAK_FILE}.tmp" "$FLATPAK_FILE"
fi

echo
echo "Make sure to update the two changelog files:"
echo " - $CHANGELOG_FILE"
echo " - $FLATPAK_FILE"

if [ "$EDITOR" != "" ]; then
echo
echo "Opening the changelog files in $EDITOR..."
"$EDITOR" "$CHANGELOG_FILE"
"$EDITOR" flatpak/com.adilhanney.ricochlime.metainfo.xml
fi
8 changes: 4 additions & 4 deletions windows/runner/Runner.rc
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,15 @@ IDI_APP_ICON ICON "resources\\app_icon.ico"
//

#if defined(FLUTTER_VERSION_MAJOR) && defined(FLUTTER_VERSION_MINOR) && defined(FLUTTER_VERSION_PATCH) && defined(FLUTTER_VERSION_BUILD)
#define VERSION_AS_NUMBER FLUTTER_VERSION_MAJOR,FLUTTER_VERSION_MINOR,FLUTTER_VERSION_PATCH,FLUTTER_VERSION_BUILD
#define VERSION_AS_NUMBER 0,1,0,0
#else
#define VERSION_AS_NUMBER 1,0,0,0
#define VERSION_AS_NUMBER 0,1,0,0
#endif

#if defined(FLUTTER_VERSION)
#define VERSION_AS_STRING FLUTTER_VERSION
#define VERSION_AS_STRING "0.1.0.0"
#else
#define VERSION_AS_STRING "1.0.0"
#define VERSION_AS_STRING "0.1.0.0"
#endif

VS_VERSION_INFO VERSIONINFO
Expand Down

0 comments on commit 4743b48

Please sign in to comment.