Debian Codegraph @

.ci/upload-nightly.ps1

raw
1 # disable progress bar since that requires a pty
2 $ProgressPreference = "SilentlyContinue"
3
4 $file = "nheko_win_64.zip"
5 $fileName = "nheko-${env:APPVEYOR_REPO_BRANCH}-${env:APPVEYOR_REPO_COMMIT}-win64.zip"
6
7 $response = Invoke-RestMethod -uri "https://matrix.neko.dev/_matrix/media/r0/upload?filename=$fileName" -Method Post -Infile "$file" -ContentType 'application/x-compressed' -Headers @{"Authorization"="Bearer ${env:MATRIX_ACCESS_TOKEN}"}
8
9 $txId = [DateTimeOffset]::Now.ToUnixTimeSeconds()
10 $fileSize = (Get-Item $file).Length
11 $body = @{
12 "body" = "${fileName}"
13 "filename"= "${fileName}"
14 "info" = @{
15 "mimetype" = "application/x-compressed"
16 "size" = ${fileSize}
17 }
18 "msgtype" = "m.file"
19 "url" = ${response}.content_uri
20 } | ConvertTo-Json
21 $room = "!TshDrgpBNBDmfDeEGN:neko.dev"
22
23 Invoke-RestMethod -uri "https://matrix.neko.dev/_matrix/client/r0/rooms/${room}/send/m.room.message/${txid}" -Method Put -Body "$body" -ContentType 'application/json' -Headers @{"Authorization"="Bearer ${env:MATRIX_ACCESS_TOKEN}"}
24
25 exit 0