Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d32fa5c91f | |||
| acdeadb06a | |||
| f3bf4a4954 | |||
| 20c962c711 |
@@ -7,22 +7,18 @@ on:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Install Rust stable
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
toolchain: stable
|
||||
targets: x86_64-pc-windows-msvc
|
||||
|
||||
- name: Build release binary
|
||||
shell: powershell
|
||||
run: cargo build --release
|
||||
|
||||
- name: Create Gitea Release
|
||||
id: create_release
|
||||
shell: powershell
|
||||
run: |
|
||||
$tag = "${{ github.ref_name }}"
|
||||
$body = @{
|
||||
@@ -42,18 +38,60 @@ jobs:
|
||||
} `
|
||||
-Body $body
|
||||
|
||||
echo "release_id=$($response.id)" >> $env:GITHUB_OUTPUT
|
||||
"release_id=$($response.id)" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
|
||||
|
||||
- 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 "https://gitea.whitlocktech.com/api/v1/repos/whitlocktech/tickr/releases/$releaseId/assets?name=tickr.exe" `
|
||||
-Uri $uri `
|
||||
-Method Post `
|
||||
-Headers @{
|
||||
Authorization = "token ${{ secrets.RELEASE_TOKEN }}"
|
||||
} `
|
||||
-InFile $filePath `
|
||||
-ContentType "application/octet-stream"
|
||||
-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
|
||||
Reference in New Issue
Block a user