depot/web/lukegbcom/deploy.sh

26 lines
753 B
Bash
Raw Normal View History

2022-04-05 02:18:57 +00:00
#!/usr/bin/env nix-shell
2022-04-05 21:04:32 +00:00
#!nix-shell -p nodePackages.firebase-tools -p vault -i bash
vault_path=unix:///run/tokend/sock
deploycmd="deploy"
postdeploy () {
return
}
if [[ "$(groups)" =~ (.* |^)"users"($| .*) ]] || ! test -f /etc/NIXOS; then
vault_path=https://vault.int.lukegb.com
channelname="$(id -un)"
deploycmd="hosting:channel:deploy $channelname"
postdeploy () {
firebase hosting:channel:open $channelname --token="$token"
}
fi
2022-04-05 02:18:57 +00:00
cd $(nix-build ../.. -A web.lukegbcom)
2022-04-05 21:04:32 +00:00
token="$(vault read --field=token --address="$vault_path" gcp/roleset/lukegbcom-deployer/token)"
firebase $deploycmd --token="$token"
# Do it twice because sometimes it doesn't actually do anything the first time
firebase $deploycmd --token="$token"
postdeploy