Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c682087de8 | |||
| 7250ec8c58 | |||
| 8a4eea282f | |||
| d63ce05d83 | |||
| ec9cf435ca | |||
| 580330b99e |
@@ -38,60 +38,25 @@ jobs:
|
||||
} `
|
||||
-Body $body
|
||||
|
||||
"release_id=$($response.id)" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
|
||||
$releaseId = $response.id
|
||||
Write-Host "Created release ID: $releaseId"
|
||||
Add-Content -Path $env:GITHUB_OUTPUT -Value "release_id=$releaseId"
|
||||
|
||||
- name: Upload binary asset
|
||||
shell: powershell
|
||||
run: |
|
||||
$releaseId = "${{ steps.create_release.outputs.release_id }}"
|
||||
$filePath = "target\release\tickr.exe"
|
||||
$filePath = (Resolve-Path "target\release\tickr.exe").Path
|
||||
|
||||
Write-Host "Working dir: $(Get-Location)"
|
||||
Write-Host "Release ID: $releaseId"
|
||||
Write-Host "File: $filePath"
|
||||
|
||||
if (!(Test-Path $filePath)) {
|
||||
Write-Error "File not found: $filePath"
|
||||
exit 1
|
||||
}
|
||||
|
||||
$uri = "https://gitea.whitlocktech.com/api/v1/repos/whitlocktech/tickr/releases/$releaseId/assets?name=tickr.exe"
|
||||
|
||||
$fileBytes = [System.IO.File]::ReadAllBytes((Resolve-Path $filePath))
|
||||
$boundary = [System.Guid]::NewGuid().ToString()
|
||||
$LF = "`r`n"
|
||||
|
||||
$bodyLines = @(
|
||||
"--$boundary",
|
||||
"Content-Disposition: form-data; name=`"attachment`"; filename=`"tickr.exe`"",
|
||||
"Content-Type: application/octet-stream",
|
||||
"",
|
||||
[System.Text.Encoding]::Latin1.GetString($fileBytes),
|
||||
"--$boundary--"
|
||||
)
|
||||
|
||||
$bodyBytes = [System.Text.Encoding]::Latin1.GetBytes($bodyLines -join $LF)
|
||||
|
||||
Invoke-RestMethod `
|
||||
-Uri $uri `
|
||||
-Method Post `
|
||||
-Headers @{ Authorization = "token ${{ secrets.RELEASE_TOKEN }}" } `
|
||||
-ContentType "multipart/form-data; boundary=$boundary" `
|
||||
-Body $bodyBytes- name: Upload binary asset
|
||||
shell: powershell
|
||||
run: |
|
||||
$releaseId = "${{ steps.create_release.outputs.release_id }}"
|
||||
$filePath = "target\release\tickr.exe"
|
||||
$uri = "https://gitea.whitlocktech.com/api/v1/repos/whitlocktech/tickr/releases/$releaseId/assets?name=tickr.exe"
|
||||
|
||||
$fileBytes = [System.IO.File]::ReadAllBytes((Resolve-Path $filePath))
|
||||
$boundary = [System.Guid]::NewGuid().ToString()
|
||||
$LF = "`r`n"
|
||||
|
||||
$bodyLines = @(
|
||||
"--$boundary",
|
||||
"Content-Disposition: form-data; name=`"attachment`"; filename=`"tickr.exe`"",
|
||||
"Content-Type: application/octet-stream",
|
||||
"",
|
||||
[System.Text.Encoding]::Latin1.GetString($fileBytes),
|
||||
"--$boundary--"
|
||||
)
|
||||
|
||||
$bodyBytes = [System.Text.Encoding]::Latin1.GetBytes($bodyLines -join $LF)
|
||||
|
||||
Invoke-RestMethod `
|
||||
-Uri $uri `
|
||||
-Method Post `
|
||||
-Headers @{ Authorization = "token ${{ secrets.RELEASE_TOKEN }}" } `
|
||||
-ContentType "multipart/form-data; boundary=$boundary" `
|
||||
-Body $bodyBytes
|
||||
|
||||
& curl.exe -X POST -H "Authorization: token ${{ secrets.RELEASE_TOKEN }}" -F "attachment=@`"$filePath`"" "$uri"
|
||||
Reference in New Issue
Block a user