Release #14
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release | |
on: | |
push: | |
tags: | |
- v*.*.* | |
workflow_dispatch: | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install uv | |
uses: astral-sh/setup-uv@v5 | |
with: | |
enable-cache: true | |
cache-dependency-glob: uv.lock | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version-file: pyproject.toml | |
- name: Install and build project | |
run: | | |
uv sync --locked --no-default-groups | |
uv build | |
- name: Upload build artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: jekyllnb-build | |
path: dist/ | |
github: | |
name: GitHub | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Download build artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: jekyllnb-build | |
path: dist | |
- name: Get changes | |
if: github.event_name == 'push' | |
run: | | |
tag=${GITHUB_REF#refs/tags/v} | |
pattern="0,/$tag/d;/[0-9]\+\.[0-9]\+\.[0-9]\+/Q" | |
sed $pattern CHANGELOG.md | head -n -1 | tail -n +2 > RELEASE.md | |
cat RELEASE.md | |
- name: Get changes | |
if: github.event_name == 'workflow_dispatch' | |
run: | | |
pattern='0,/[0-9]\+\.[0-9]\+\.[0-9]\+/d;/[0-9]\+\.[0-9]\+\.[0-9]\+/Q' | |
sed $pattern CHANGELOG.md | head -n -1 | tail -n +2 > RELEASE.md | |
cat RELEASE.md | |
- name: Create release | |
uses: softprops/action-gh-release@v2 | |
if: success() && github.event_name == 'push' | |
with: | |
body_path: RELEASE.md | |
prerelease: ${{ contains(github.ref, '-') }} | |
files: dist/* | |
pypi: | |
name: PyPI | |
runs-on: ubuntu-latest | |
needs: build | |
environment: pypi | |
permissions: | |
# required for PyPI's trusted publishing | |
id-token: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Download build artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: jekyllnb-build | |
path: dist | |
- name: Install uv | |
uses: astral-sh/setup-uv@v5 | |
with: | |
enable-cache: true | |
cache-dependency-glob: uv.lock | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version-file: pyproject.toml | |
- name: Publish to PyPI | |
if: success() && github.event_name == 'push' | |
run: uv publish | |
- name: Publish to TestPyPI | |
if: success() && github.event_name == 'workflow_dispatch' | |
run: uv publish | |
env: | |
UV_PUBLISH_URL: https://test.pypi.org/legacy/ |