-
Notifications
You must be signed in to change notification settings - Fork 2
90 lines (76 loc) · 3.04 KB
/
Copy pathprepare-release.yml
File metadata and controls
90 lines (76 loc) · 3.04 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
name: CD - Prepare release PR
# Runs the same logic as ``scripts/release_prepare.py`` locally: bump versions,
# assemble ``CHANGELOG.md`` with Towncrier, commit, push a branch, open a PR.
# Tagging ``v*`` remains a deliberate maintainer step after merge (see docs/releasing.rst).
on:
workflow_dispatch:
inputs:
version:
description: "PEP 440 version (e.g. 0.4.0 or 0.4.0a1), no v prefix"
required: true
type: string
release_date:
description: "Towncrier release date (YYYY-MM-DD); leave empty for today (UTC)"
required: false
type: string
permissions:
contents: write
pull-requests: write
jobs:
open-pr:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
with:
ref: main
fetch-depth: 0
- name: Set up uv
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b
with:
python-version: "3.12"
enable-cache: true
- name: Sync dev dependencies
run: uv sync --locked --dev
- name: Compute branch name and release date
id: meta
shell: bash
run: |
VERSION="${{ github.event.inputs.version }}"
echo "branch=chore/release-prep-${VERSION}" >> "$GITHUB_OUTPUT"
D="${{ github.event.inputs.release_date }}"
if [ -z "$D" ]; then
D=$(date -u +"%Y-%m-%d")
fi
echo "date=${D}" >> "$GITHUB_OUTPUT"
- name: Configure git author
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
- name: Create release prep branch
run: git checkout -b "${{ steps.meta.outputs.branch }}"
- name: Run release_prepare.py
run: |
uv run python scripts/release_prepare.py "${{ github.event.inputs.version }}" \
--date "${{ steps.meta.outputs.date }}" \
--commit \
--any-branch
- name: Push branch
run: git push -u origin "${{ steps.meta.outputs.branch }}"
- name: Open pull request
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERSION: ${{ github.event.inputs.version }}
RDATE: ${{ steps.meta.outputs.date }}
BRANCH: ${{ steps.meta.outputs.branch }}
run: |
cat > "$RUNNER_TEMP/pr-body.md" <<EOF
Automated release preparation for **${VERSION}** (Towncrier date: *${RDATE}*).
**Review**
- \`src/dbs_annotator/__init__.py\` and \`[tool.briefcase].version\` in \`pyproject.toml\` match **${VERSION}**.
- \`CHANGELOG.md\` for this version; removed \`newsfragments/*.md\` files were consumed by Towncrier.
**After merge** tag the merge commit and push \`v${VERSION}\`; see \`docs/releasing.rst\`. Pushing \`v*\` triggers \`release.yml\`.
EOF
gh pr create --base main --head "$BRANCH" \
--title "chore(release): prepare v${VERSION}" \
--body-file "$RUNNER_TEMP/pr-body.md"