-
Notifications
You must be signed in to change notification settings - Fork 2
/
upload_cartridge_release.sh
executable file
·66 lines (53 loc) · 2.28 KB
/
upload_cartridge_release.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/bash
# Update exported cartridge release to itch.io via butler
# Make sure to first build, export and patch game, and also to have pushed a tag for release.
# Travis generates picosonic_v${BUILD_VERSION}_release_cartridges.zip containing .p8 files
# for release, but we need pico8 to build _png_cartridges, .bin and _web, so we always
# export those from a local computer.
# Dependencies:
# - butler
# You also need to be signed in on itch.io as a collaborator on this project!
# Configuration: paths
data_path="$(dirname "$0")/data"
# Linux only
carts_dirpath="$HOME/.lexaloffle/pico-8/carts"
# Configuration: cartridge
version=`cat "$data_path/version.txt"`
export_folder="$carts_dirpath/picosonic/v${version}_release"
cartridge_basename="picosonic_v${version}_release"
rel_bin_folder="${cartridge_basename}.bin"
help() {
echo "Push build with specific version for all platforms to itch.io with butler."
usage
}
usage() {
echo "Usage: upload_cartridge_release.sh
"
}
if [[ $# -ne 0 ]]; then
echo "Wrong number of arguments: found $#, expected 0."
echo "Passed arguments: $@"
usage
exit 1
fi
# Arg $1: platform/format ('linux', 'osx', 'windows', 'web', 'png', 'p8')
# Arg $2: path to archive corresponding to platform/format
function butler_push_game_for_platform {
platform="$1"
filepath="$2"
butler push --fix-permissions --userversion="$version" \
"$filepath" "komehara/pico-sonic:$platform"
}
pushd "${export_folder}"
# Travis builds and releases .p8 cartridges packed in .zip, so focus on other platforms/formats
# Upload web first, it matters for the initial upload as first one will be considered as web version
# when using embedded web game on itch.io
# itch.io's butler will be good enough to diff zips even if folder and file names slightly change with
# release versions.
butler_push_game_for_platform web "${cartridge_basename}_web.zip"
butler_push_game_for_platform linux "${rel_bin_folder}/${cartridge_basename}_linux.zip"
butler_push_game_for_platform osx "${rel_bin_folder}/${cartridge_basename}_osx.zip"
butler_push_game_for_platform windows "${rel_bin_folder}/${cartridge_basename}_windows.zip"
butler_push_game_for_platform png "${cartridge_basename}_png_cartridges.zip"
butler_push_game_for_platform p8 "${cartridge_basename}_cartridges.zip"
popd