this repo has no description
4
fork

Configure Feed

Select the types of activity you want to include in your feed.

refactor(deploy): use std/log to log

dusk f555033b 792d7e01

+5 -8
+5 -8
deploy.nu
··· 1 1 #!/usr/bin/env nu 2 2 3 3 use std "path add" 4 + use std/log 4 5 5 6 path add /nix/var/nix/profiles/default/bin 6 7 7 8 # load webhook secrets 8 9 rage -d -i ./ssh_key ./secrets/deployWebhook.age | from toml | load-env 9 - 10 - def log [msg: string, --type (-t): string = "info"] { 11 - print $"[($type)][(date now | format date "%H:%M:%S")] ($msg)" 12 - } 13 10 14 11 def webhook [title: string, content: string, exit_code?: number, ping?: bool = false] { 15 12 let type = if $exit_code == null { "⌛" } else if $exit_code == 0 { "✔️" } else { "❌" } ··· 24 21 }] 25 22 } 26 23 27 - log -t debug "posting webhook...." 24 + log debug "posting webhook...." 28 25 http post --content-type application/json $"https://discord.com/api/webhooks/($env.WEBHOOK_ID)/($env.WEBHOOK_TOKEN)" $msg 29 26 } 30 27 31 28 def deploy [hostname: string] { 32 - log $"trying to deploy host ($hostname)" 29 + log info $"trying to deploy host ($hostname)" 33 30 let hooktitle = $"/($hostname)/deploy" 34 31 35 32 let start = date now ··· 43 40 } 44 41 45 42 def update-input [input: string] { 46 - log $"trying to update input ($input)" 43 + log info $"trying to update input ($input)" 47 44 let result = nix flake update $input | complete 48 45 let is_ok = ($result.stderr | str contains "Updated input") 49 46 let is_err = ($result.exit_code != 0) ··· 67 64 update-input "blog" 68 65 69 66 try { 70 - log "trying to update dns records" 67 + log info "trying to update dns records" 71 68 nix run ".#dns" -- push 72 69 } catch { |err| 73 70 webhook "dns" $"=== error pushing dns ===\n\n($err.msg | to text)" 1