06c536bcb7
- Updated Python CI to streamline linting, type checking, and testing processes, including the addition of a wheel build job. - Refactored Rust CI to utilize pre-built actions for cargo-deny and cargo-audit, improving dependency checks. - Optimized WASM CI by consolidating build and test steps, and ensuring proper artifact uploads for both Node.js and web packages. - Added token authentication for GitHub actions in the release workflow to enhance security.
63 lines
1.8 KiB
YAML
63 lines
1.8 KiB
YAML
name: Release
|
|
|
|
# Triggered when a version tag is pushed (e.g. v1.0.3).
|
|
# Creates a GitHub Release marked as "published", which in turn
|
|
# triggers the build-wheels and publish jobs in CI.yml.
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- "v*.*.*"
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
create-release:
|
|
name: Create GitHub Release
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
with:
|
|
fetch-depth: 0
|
|
token: ${{ secrets.GH_PAT }}
|
|
|
|
- name: Extract version from tag
|
|
id: version
|
|
run: |
|
|
VERSION="${GITHUB_REF_NAME#v}"
|
|
if ! [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+([-.][0-9A-Za-z.]+)?$ ]]; then
|
|
echo "Expected a semantic-version tag like v1.0.3 or v1.0.3-rc1, got: $GITHUB_REF_NAME"
|
|
exit 1
|
|
fi
|
|
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Extract changelog entry for this version
|
|
id: changelog
|
|
env:
|
|
TAG_NAME: ${{ github.ref_name }}
|
|
run: |
|
|
python3 - <<'PY'
|
|
import re, os, pathlib
|
|
|
|
version = os.environ["TAG_NAME"].lstrip("v")
|
|
text = pathlib.Path("CHANGELOG.md").read_text(encoding="utf-8")
|
|
|
|
pattern = rf"## \[{re.escape(version)}\].*?\n(.*?)(?=\n## |\Z)"
|
|
match = re.search(pattern, text, re.DOTALL)
|
|
body = match.group(1).strip() if match else f"Release {version}"
|
|
|
|
with open(os.environ["GITHUB_OUTPUT"], "a") as f:
|
|
f.write(f"body<<EOF\n{body}\nEOF\n")
|
|
PY
|
|
|
|
- name: Create GitHub Release
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
tag_name: ${{ github.ref_name }}
|
|
name: v${{ steps.version.outputs.version }}
|
|
body: ${{ steps.changelog.outputs.body }}
|
|
draft: false
|
|
prerelease: ${{ contains(github.ref_name, '-') }}
|
|
token: ${{ secrets.GH_PAT }}
|