test create-release
All checks were successful
CI/CD Test / build-deploy (pull_request) Successful in 1s
CI/CD Test / create-release (pull_request) Has been skipped

This commit is contained in:
Timi
2026-01-17 11:10:32 +08:00
parent 42243e4b28
commit 9747d65eda

View File

@ -27,3 +27,26 @@ jobs:
if: success() if: success()
run: | run: |
echo "Deploying to production..." echo "Deploying to production..."
create-release:
runs-on: self-hosted
needs: build-deploy
if: ${{ success() && github.ref == 'refs/heads/master' }}
steps:
- name: Create release
env:
GITEA_TOKEN: ${{ secrets.RUNNER_TOKEN }}
GITEA_SERVER_URL: ${{ github.server_url }}
GITEA_REPOSITORY: ${{ github.repository }}
RELEASE_TAG: ci-${{ github.run_id }}
RELEASE_TARGET: ${{ github.sha }}
run: |
if (-not $env:GITEA_TOKEN) { throw "Missing secrets.GITEA_TOKEN" }
$apiUrl = "$($env:GITEA_SERVER_URL)/api/v1/repos/$($env:GITEA_REPOSITORY)/releases"
$body = @{
tag_name = $env:RELEASE_TAG
name = $env:RELEASE_TAG
target_commitish = $env:RELEASE_TARGET
draft = $false
prerelease = $false
} | ConvertTo-Json
Invoke-RestMethod -Method Post -Uri $apiUrl -Headers @{ Authorization = "token $($env:GITEA_TOKEN)" } -Body $body -ContentType "application/json"