-
Notifications
You must be signed in to change notification settings - Fork 2
/
publish-on-itch.io.sh
executable file
·41 lines (36 loc) · 1.44 KB
/
publish-on-itch.io.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
#!/bin/bash
set -o pipefail -o errexit -o nounset -o xtrace
cd $(dirname ${BASH_SOURCE[0]})
declare -A gamesOnItchIo
gamesOnItchIo['2200_le_jugement_des_dieux']='2200-le-jugement-des-dieux'
gamesOnItchIo[gdav]=ameres-victoires-glorieuses-defaites
gamesOnItchIo[LesCouloirsDuTemps]=les-couloirs-du-temps
gamesOnItchIo[LesNonMorts]=les-non-morts
gamesOnItchIo[CyberPunk]=cyberpunk
gamesOnItchIo[BladesInTheDark-Interrogatoires]=blades-in-the-dark-interrogatoires
gamesOnItchIo[BladesInTheDark-Interrogation]=blades-in-the-dark-interrogation
gamesOnItchIo[ParadisPerdu]=modules-de-secours
GITHUB_REF=${1?-'git ref must be provided as argument'}
GIT_TAG=${GITHUB_REF##*/}
gitTagPrefix=${GIT_TAG%-*}
echo gitTagPrefix=$gitTagPrefix
gameIdOnItchIo="${gamesOnItchIo[${gitTagPrefix}]:-}"
version=${GIT_TAG##*-}
if [ -z "$gameIdOnItchIo" ]; then
echo "No mapping found for $gitTagPrefix - aborting"
exit 0
fi
if [ -z "${BUTLER_API_KEY:-}" ]; then
echo '$BUTLER_API_KEY undefined - aborting'
exit 1
fi
echo 'Installing butler CLI' # cf. https://itch.io/docs/butler/installing.html
curl -L -o butler.zip https://broth.itch.ovh/butler/linux-amd64/LATEST/archive/default
unzip butler.zip
chmod +x butler
./butler -V
# Publish a folder that IS *exactly* the release build:
mkdir -p itchio && rm -f itchio/*.*
cp $GIT_TAG*.pdf itchio/
echo "Now publishing $gameIdOnItchIo @ $version on itch.io:"
./butler push itchio Lucas-C/$gameIdOnItchIo:pdf --userversion $version