Files
tickr/.gitea/workflows/release.yml
2026-05-17 01:20:36 -05:00

59 lines
1.7 KiB
YAML

name: Build and Release
on:
push:
tags:
- 'v*'
jobs:
build:
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
run: cargo build --release
- name: Create Gitea Release
id: create_release
run: |
$tag = "${{ github.ref_name }}"
$body = @{
tag_name = $tag
name = "Tickr $tag"
body = "Automated release $tag"
draft = $false
prerelease = $false
} | ConvertTo-Json
$response = Invoke-RestMethod `
-Uri "https://gitea.whitlocktech.com/api/v1/repos/whitlocktech/tickr/releases" `
-Method Post `
-Headers @{
Authorization = "token ${{ secrets.RELEASE_TOKEN }}"
"Content-Type" = "application/json"
} `
-Body $body
echo "release_id=$($response.id)" >> $env:GITHUB_OUTPUT
- name: Upload binary asset
run: |
$releaseId = "${{ steps.create_release.outputs.release_id }}"
$filePath = "target\release\tickr.exe"
Invoke-RestMethod `
-Uri "https://gitea.whitlocktech.com/api/v1/repos/whitlocktech/tickr/releases/$releaseId/assets?name=tickr.exe" `
-Method Post `
-Headers @{
Authorization = "token ${{ secrets.RELEASE_TOKEN }}"
} `
-InFile $filePath `
-ContentType "application/octet-stream"