Skip to content

Instantly share code, notes, and snippets.

@crcdng
Last active October 6, 2024 22:46
Show Gist options
  • Select an option

  • Save crcdng/5d21f0ba770a8a68aecc86e319ef6aa3 to your computer and use it in GitHub Desktop.

Select an option

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
#!/bin/sh
# builds and prepares a Flutter/Flame web build for 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 &&
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