[Code Share] [Fly Utility Script] Fly.io "ship it" script

Hey there!
I thought id share a small script ive made for flyctl.
It automatically installs flyctl, logs in (although auth token option exists), and exports to path (if needed).
Then, it deploys your app!

I find this useful when swapping between devices that dont have flyctl and wanting a quick way to get my app up and running in one command only (as if fly was installed i could do fly deploy)
I hope you will find it useful, and maybe use it in your apps.

#!/bin/bash
# Unofficial "just ship it" script for fly.io apps
# Configuration
INSTALL_FLY="https://fly.io/install.sh"
ACCESS_TOKEN="" # Leave blank for login prompt

# --------------------------

# smooshed together by @gavingogaming
if [ ! -d "$HOME/.fly" ]; then
    sudo curl "$INSTALL_FLY" | sh
    export PATH="$HOME/.fly/bin:$PATH"
    if [ "$ACCESS_TOKEN" == "" ]; then
        fly auth login
    fi
fi

if [[ $PATH == *".fly/bin"* ]]; then
    echo "Fly in path, will not export"
else
    export PATH="$HOME/.fly/bin:$PATH"
fi

if [ "$ACCESS_TOKEN" == "" ]; then
    fly deploy
else
    fly deploy -t "$ACCESS_TOKEN"
fi

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.