mirror of
https://github.com/fastapi/fastapi.git
synced 2026-09-13 22:12:40 -04:00
68 lines
2.3 KiB
YAML
68 lines
2.3 KiB
YAML
name: Create Draft Release
|
|
|
|
on:
|
|
pull_request:
|
|
types:
|
|
- closed
|
|
|
|
permissions: {}
|
|
|
|
env:
|
|
UV_NO_SYNC: true
|
|
|
|
jobs:
|
|
create-draft-release:
|
|
if: github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'release')
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 5
|
|
permissions:
|
|
contents: write
|
|
env:
|
|
PREPARE_RELEASE_VERSION_FILE: fastapi/__init__.py
|
|
PREPARE_RELEASE_RELEASE_NOTES_FILE: docs/en/docs/release-notes.md
|
|
steps:
|
|
- name: Dump GitHub context
|
|
env:
|
|
GITHUB_CONTEXT: ${{ toJson(github) }}
|
|
run: echo "$GITHUB_CONTEXT"
|
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
with:
|
|
ref: ${{ github.event.repository.default_branch }}
|
|
persist-credentials: true
|
|
- name: Set up Python
|
|
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
|
|
with:
|
|
python-version-file: ".python-version"
|
|
- name: Install uv
|
|
uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0
|
|
with:
|
|
# Before upgrading uv version, make sure astral-sh/setup-uv knows its checksum.
|
|
# See: https://github.com/astral-sh/setup-uv/issues/851#issuecomment-4282017837
|
|
version: "0.11.30"
|
|
cache-dependency-glob: |
|
|
pyproject.toml
|
|
uv.lock
|
|
cache-suffix: dev-all
|
|
# Disable saving cache as we install narrower set of dependencies than dev-all has.
|
|
save-cache: false
|
|
- name: Install dependencies
|
|
run: uv sync --locked --group dev
|
|
- name: Extract release details
|
|
id: release-details
|
|
run: |
|
|
set -euo pipefail
|
|
version="$(uv run python scripts/prepare_release.py current-version)"
|
|
uv run python scripts/prepare_release.py release-notes > draft-release-notes.md
|
|
echo "version=$version" >> "$GITHUB_OUTPUT"
|
|
- name: Create draft release
|
|
env:
|
|
GH_TOKEN: ${{ github.token }}
|
|
VERSION: ${{ steps.release-details.outputs.version }}
|
|
run: |
|
|
set -euo pipefail
|
|
gh release create "$VERSION" \
|
|
--draft \
|
|
--title "$VERSION" \
|
|
--notes-file draft-release-notes.md \
|
|
--target "$(git rev-parse HEAD)"
|