this repo has no description
4
fork

Configure Feed

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

feat(deploy): properly detect nvfetcher updating inputs, and reenable discord webhook uploading

dusk a268da69 6869b3f1

+10 -11
+10 -11
deploy.nu
··· 28 28 } else { 29 29 log error $content 30 30 } 31 - # http post --content-type application/json $"https://discord.com/api/webhooks/($env.WEBHOOK_ID)/($env.WEBHOOK_TOKEN)" $msg 31 + http post --content-type application/json $"https://discord.com/api/webhooks/($env.WEBHOOK_ID)/($env.WEBHOOK_TOKEN)" $msg 32 32 } 33 33 34 34 def upload-paste []: any -> string { 35 - # let paste_url = http post --content-type multipart/form-data "https://0x0.st" {file: ($in | to text | into binary), secret: true} 36 - # return $paste_url 37 - return "" 35 + let paste_url = http post --content-type multipart/form-data "https://0x0.st" {file: ($in | to text | into binary), secret: true} 36 + return $paste_url 38 37 } 39 38 40 39 def time-block [block]: nothing -> record { ··· 101 100 return 102 101 } 103 102 103 + try { git push } 104 104 webhook $hooktitle $"=== deploy for ($hostname): finished ===" 0 true 105 105 } 106 106 ··· 114 114 } 115 115 log info $"trying to update inputs ($inputsText)" 116 116 let result = nix run .#nvfetcher -- -f $"\(($inputs | str join '|')\)" | complete 117 - let is_ok = ($result.stderr | str contains "Updated input") 118 - let is_err = ($result.exit_code != 0) 119 - if $is_ok or $is_err { 120 - webhook $"/inputs" $"=== updated inputs ===\n\n($result.stderr)" $result.exit_code 117 + let is_ok = ($result.stdout | str contains "Changes:") 118 + if $is_ok { 119 + let changes_content = $result.stdout | lines | skip until {|line| $line | str contains "Changes:"} | skip 1 | str join "\n" 120 + webhook $"/inputs" $"=== updated inputs ===\n\n($changes_content)" $result.exit_code 121 121 } 122 122 if $is_ok { 123 123 # try committing flake updates 124 124 try { 125 125 git add _sources 126 126 git commit -m "chore(nix): update inputs [skip ci]" 127 - git push 128 127 } 129 128 } else { 130 129 try { ··· 139 138 } 140 139 141 140 def main [hostname: string = "wolumonde", --only-deploy (-d)] { 142 - webhook "deploy" "=== started deploying all ===" 141 + webhook "deploy" "=== started deploying ===" 143 142 144 143 if $only_deploy == false { 145 - update-inputs ["blog" "limbusart" "nsid-tracker"] 144 + update-inputs ["blog" "limbusart" "nsid-tracker" "tangled" "headplane"] 146 145 try { 147 146 log info "trying to update dns records" 148 147 nix run ".#dns" -- push