name: Build and Release on: push: tags: - 'v*' jobs: build: runs-on: windows-latest steps: - name: Checkout uses: actions/checkout@v3 - 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 = @{ 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 "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" curl.exe -v` -X POST ` -H "Authorization: token ${{ secrets.RELEASE_TOKEN }}" ` -F "attachment=@$filePath" ` "https://gitea.whitlocktech.com/api/v1/repos/whitlocktech/tickr/releases/$releaseId/assets?name=tickr.exe"