Files
MercuryToolbox/.gitea/workflows/release.yml
T

62 lines
1.8 KiB
YAML

name: release
on:
push:
tags:
- "v*"
workflow_dispatch:
inputs:
tag:
description: Git tag to publish, for example v0.1.0
required: true
type: string
permissions: write-all
jobs:
publish:
runs-on: windows
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Resolve release tag
shell: pwsh
run: |
$tag = if ($env:GITHUB_REF_TYPE -eq 'tag' -and -not [string]::IsNullOrWhiteSpace($env:GITHUB_REF_NAME)) {
$env:GITHUB_REF_NAME
} else {
'${{ inputs.tag }}'
}
if ([string]::IsNullOrWhiteSpace($tag)) {
throw 'Release tag is required.'
}
$notesPath = Join-Path 'docs/releases' "$tag.md"
if (-not (Test-Path -LiteralPath $notesPath)) {
throw "Release notes not found: $notesPath"
}
"RELEASE_TAG=$tag" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
"RELEASE_NOTES_PATH=$notesPath" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Verify tag matches workspace version
shell: pwsh
run: pwsh -NoProfile -File .\scripts\check-release-version.ps1 -Tag $env:RELEASE_TAG
- name: Full release gate
shell: pwsh
run: just jade
- name: Build release package
shell: pwsh
run: just package
- name: Publish Gitea release
shell: pwsh
run: |
if ([string]::IsNullOrWhiteSpace($env:GITEA_TOKEN)) {
throw 'GITEA_TOKEN is not available in the release job environment.'
}
pwsh -NoProfile -File .\scripts\publish-gitea-release.ps1 -Tag $env:RELEASE_TAG -NotesPath $env:RELEASE_NOTES_PATH -ApiToken $env:GITEA_TOKEN