Uploads a single file as a Now deployment
#!/bin/bash | |
set -euo pipefail | |
input="$1" | |
shift | |
files_dir="$HOME/files" | |
mkdir -p "$files_dir" | |
# Delete old files | |
rm -f "$files_dir"/* | |
# Copy in the source file | |
cp "$input" "$files_dir" | |
cd "$files_dir" | |
# Create the `now.json` file | |
jq -n --arg file "$input" '{ version: 2, rewrites: [ { "source": "/", "destination": @uri "/\($file)" } ], builds: [ { src: "**/*", use: "@now/static" } ] }' > now.json | |
# Create deployment, copying the root `url` to clipboard instead of the aliased URL | |
url="$(now --prod --no-clipboard)" | |
printf "%s" "$url" | pbcopy | |
echo "Unique URL: $url" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment