-
-
Notifications
You must be signed in to change notification settings - Fork 398
77 lines (66 loc) · 2.64 KB
/
prepare_release.yml
File metadata and controls
77 lines (66 loc) · 2.64 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
name: Prepare release notes
on:
workflow_dispatch:
inputs:
version:
description: 'Release version notes (e.g. 3.2.0)'
required: true
type: string
target_branch:
description: 'Branch to target'
required: false
default: 'main'
type: string
permissions:
contents: write
pull-requests: write
jobs:
prepare:
name: Build changelog and open PR
runs-on: ubuntu-latest
steps:
- name: Validate inputs
run: |
if [[ ! "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+([-\.][a-zA-Z0-9]+)*$ ]]; then
echo "::error::Invalid version format: '$VERSION'"
exit 1
fi
if [[ ! "$TARGET_BRANCH" =~ ^[a-zA-Z0-9._/-]+$ ]]; then
echo "::error::Invalid branch name: '$TARGET_BRANCH'"
exit 1
fi
env:
VERSION: ${{ inputs.version }}
TARGET_BRANCH: ${{ inputs.target_branch }}
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: ${{ inputs.target_branch }}
fetch-depth: 0
persist-credentials: false
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: '3.12'
- name: Install towncrier
run: pip install towncrier
- name: Build changelog
run: towncrier build --version "$VERSION" --yes
env:
VERSION: ${{ inputs.version }}
- name: Create pull request
uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8
with:
branch: release/v${{ inputs.version }}
base: ${{ inputs.target_branch }}
title: "Release v${{ inputs.version }}"
body: |
Automated release preparation for v${{ inputs.version }}.
This PR was generated by the "Prepare release" workflow. It includes:
- Rendered changelog via `towncrier build --version ${{ inputs.version }}`
- Removal of consumed changelog fragments from `changes/`
## Checklist
- [ ] Review the rendered changelog in `docs/release-notes.md`
- [ ] Downstream tests pass (see [downstream workflow](https://github.com/zarr-developers/zarr-python/actions/workflows/downstream.yml))
- [ ] Merge this PR, then [draft a GitHub Release](https://github.com/zarr-developers/zarr-python/releases/new) targeting `${{ inputs.target_branch }}` with tag `v${{ inputs.version }}`
commit-message: "chore: build changelog for v${{ inputs.version }}"
labels: run-downstream
delete-branch: true