■ ■ ■ ■ ■ ■
.github/scripts/docker-create.sh
skipped 6 lines 7 7 # Display Help 8 8 echo "A versatile script to create a docker image for testing. Call this script with no arguments to simply create a local image that you can use to test your changes. For more complex use see the below help section" 9 9 echo 10 - echo "Syntax: docker-create.sh [-h (help)|-t (test)|-p (publish)|-e (herokud)|-f (herokup)|-n (notag) [tag={tag}|message={message}|buildarg={buildarg}|springProfile={springProfile}]" 10 + echo "Syntax: docker-create.sh [-h (help)|-t (test)|-p (publish)|-e (herokud)|-f (herokup)|-g ( fly ) | - n (notag) [tag={tag}|message={message}|buildarg={buildarg}|springProfile={springProfile}]" 11 11 echo "options: (All optional)" 12 12 echo "tag= Write a custom tag that will be added to the container when it is build locally." 13 13 echo "message= Write a message used for the actual tag-message in git" skipped 6 lines 20 20 # Heroku helpers # 21 21 ################################################################################ 22 22 23 + break_on_tag(){ 24 + if test -n "${tag+x}"; then 25 + echo "tag is set" 26 + else 27 + echo "tag ${tag} was not set properly, aborting" 28 + exit 29 + fi 30 + } 23 31 heroku_check_container() { 24 - if test -n "${tag+x}"; then 25 - echo "tag is set" 26 - else 27 - echo "tag ${tag} was not set properly, aborting" 28 - exit 29 - fi 32 + break_on_tag 30 33 echo "validating dockerfile to contain tag "${tag}" (should be part of '$(head -n 1 ../../Dockerfile.web)')" 31 34 if [[ "$(head -n 1 ../../Dockerfile.web)" != *"${tag}"* ]]; then 32 35 echo "tag ${tag} in dockerfile FROM was not set properly, aborting" skipped 28 lines 61 64 exit 62 65 } 63 66 67 + Fly_publish(){ 68 + echo "Publishing to Fly.io (wrongsecrets.fly.dev)" 69 + echo "Check if all required binaries are installed" 70 + source ../../scripts/check-available-commands.sh 71 + checkCommandsAvailable fly 72 + break_on_tag 73 + echo "validating fly.toml to contain tag "${tag}" (should be part of '$(cat ../../fly.toml | grep argBasedVersion)')" 74 + if [[ "$(cat ../../fly.toml | grep argBasedVersion)" != *"${tag}"* ]]; then 75 + echo "tag ${tag} in fly.toml not properly set, aborting" 76 + exit 77 + fi 78 + cd ../.. && fly deploy 79 + exit 80 + } 81 + 64 82 ################################################################################ 65 83 ################################################################################ 66 84 # Main program # skipped 5 lines 72 90 # Set option to local if no option provided 73 91 script_mode="local" 74 92 # Parse provided options 75 - while getopts ":htpefn *" option; do 93 + while getopts ":htpefgn *" option; do 76 94 case $option in 77 95 h) # display Help 78 96 Help skipped 11 lines 90 108 f) # Helper 91 109 script_mode="heroku_p" 92 110 ;; 111 + g) #Helper 112 + script_mode="fly_p" 113 + ;; 93 114 n) #notags 94 115 disable_tagging_in_git="true" 95 116 ;; skipped 10 lines 106 127 ################################################ 107 128 for ARGUMENT in "$@"; 108 129 do 109 - if [[ $ARGUMENT != "-h" && $ARGUMENT != "-t" && $ARGUMENT != "-p" && $ARGUMENT != "-e" && $ARGUMENT != "-f" ]] 130 + if [[ $ARGUMENT != "-h" && $ARGUMENT != "-t" && $ARGUMENT != "-p" && $ARGUMENT != "-e" && $ARGUMENT != "-f" & & $ ARGUMENT ! = " - g " ]] 110 131 then 111 132 KEY=$(echo "$ARGUMENT" | cut -f1 -d=) 112 133 KEY_LENGTH=${#KEY} skipped 52 lines 165 186 Heroku_publish_demo 166 187 elif [[ $script_mode == "heroku_p" ]]; then 167 188 Heroku_publish_prod 189 + elif [[ $script_mode == "fly_p" ]]; then 190 + Fly_publish 168 191 fi 169 192 170 193 skipped 176 lines