Merge pull request 'test create-release' (#5) from dev into master
Reviewed-on: #5
This commit is contained in:
@ -27,3 +27,26 @@ jobs:
|
||||
if: success()
|
||||
run: |
|
||||
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"
|
||||
|
||||
Reference in New Issue
Block a user