dotfiles/packages/scripts/to-s3/to-s3
Christopher Mühl 786af32daf
Publish my config
This is the result of ~100 commits to my NixOS config. Since I haven't
always used `agenix-rekey`, this is another initial commit so that none
of the secrets in my git history are leaked
2025-07-30 23:36:39 +02:00

23 lines
648 B
Bash
Executable file

#!/usr/bin/env bash
set -eo pipefail
# Get only the base name for when using relative paths
base=$(basename "$1")
extension=${base//^.*\.//}
if [ "png" == "$extension" ]; then
bucket_path="screenshots"
else
bucket_path="snippets"
fi
# Upload the file
oci os object put -bn share.muehl.dev --name "${bucket_path}/${base}" --file "${1}" --force
# Send notifications and copy the URL to the clipboard
notify-send "File Uploaded" "https://share.muehl.dev/${bucket_path}/${base}"
echo "https://share.muehl.dev/${bucket_path}/${base}"
echo -n "https://share.muehl.dev/${bucket_path}/${base}" | xclip
(xclip -o) | xclip -selection clipboard