-
-
Notifications
You must be signed in to change notification settings - Fork 77
56 lines (53 loc) · 1.97 KB
/
create-draft-release.yml
File metadata and controls
56 lines (53 loc) · 1.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
name: Create Draft Release
on:
pull_request:
types:
- closed
permissions: {}
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: src/fastapi_cli/__init__.py
PREPARE_RELEASE_RELEASE_NOTES_FILE: release-notes.md
steps:
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: ${{ github.event.repository.default_branch }}
persist-credentials: true
- name: Set up Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version-file: ".python-version"
- name: Install uv
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.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.4"
- 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)"