chore(release): prepare public source release
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
name: ci
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
workflow_dispatch:
|
||||
|
||||
permissions: read-all
|
||||
|
||||
jobs:
|
||||
verify:
|
||||
runs-on: windows
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Commit messages
|
||||
shell: pwsh
|
||||
run: |
|
||||
$event = Get-Content -Raw -LiteralPath $env:GITHUB_EVENT_PATH | ConvertFrom-Json
|
||||
$range = switch ($env:GITHUB_EVENT_NAME) {
|
||||
'pull_request' { "$($event.pull_request.base.sha)..$($event.pull_request.head.sha)" }
|
||||
'push' {
|
||||
if ($event.before -match '^0+$') {
|
||||
$event.after
|
||||
}
|
||||
elseif (git merge-base --is-ancestor $event.before $event.after) {
|
||||
"$($event.before)..$($event.after)"
|
||||
}
|
||||
else {
|
||||
"$($event.after)^..$($event.after)"
|
||||
}
|
||||
}
|
||||
default { 'HEAD' }
|
||||
}
|
||||
pwsh -NoProfile -File .\scripts\check-conventional-commits.ps1 -Range $range
|
||||
|
||||
- name: Toolchain snapshot
|
||||
shell: pwsh
|
||||
run: |
|
||||
cargo --version
|
||||
rustc --version
|
||||
cargo nextest --version
|
||||
cargo llvm-cov --version
|
||||
just --version
|
||||
git --version
|
||||
pwsh --version
|
||||
|
||||
- name: Quick repo gate
|
||||
shell: pwsh
|
||||
run: just workspace-check
|
||||
|
||||
- name: Tests
|
||||
shell: pwsh
|
||||
run: cargo nextest run --all-features
|
||||
|
||||
- name: Clippy
|
||||
shell: pwsh
|
||||
run: cargo clippy --all-targets --all-features -- -D warnings -W clippy::pedantic -W clippy::nursery
|
||||
|
||||
- name: Packaging ecosystem
|
||||
shell: pwsh
|
||||
run: just ecosystem-fast
|
||||
@@ -0,0 +1,61 @@
|
||||
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
|
||||
Reference in New Issue
Block a user