Last active
May 28, 2024 14:07
-
-
Save crcdng/5d21f0ba770a8a68aecc86e319ef6aa3 to your computer and use it in GitHub Desktop.
shell script to build and prepare a Flutter/Flame web project for itch.io
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# shell script to build and prepare a Flutter/Flame web project for itch.io | |
# tested on Mac | |
# after uploading set the dimensions in the "Embed options" section on itch.io | |
# set these parameters before running | |
PROJECT_NAME='NAME' | |
PROJECT_DIR='FULL PATH TO THE FLUTTER DIRECTORY OF YOUR PROJECT' | |
TEMP_BUILD_DIR='FULL PATH TO A TEMPORARY DIRECTORY (WILL BE CREATED AND DELETED AT THE END)' | |
OUTPUT_DIR='FULL PATH TO THE DIRECTORY WHERE THE ZIP FILE READY FOR UPLOAD TO ITCH.IO WILL BE PUT' | |
cd $PROJECT_DIR && | |
flutter build web && | |
cp -R "${PROJECT_DIR}/build/web" $TEMP_BUILD_DIR && | |
sleep 1 && # recently breaks without waiting a bit after building | |
cd $TEMP_BUILD_DIR && | |
sed -i '' 's/<base href="\/">//g' index.html && | |
zip -vr "${OUTPUT_DIR}/${PROJECT_NAME}_$(date +%Y%m%d-%H%M%S).zip" ./ -x "*.DS_Store" && | |
rm -r $TEMP_BUILD_DIR |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment