-
Notifications
You must be signed in to change notification settings - Fork 3
65 lines (53 loc) · 2.57 KB
/
prepare-release-action.yml
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
---
name: Prepare Release PR
on:
workflow_call:
workflow_dispatch:
inputs:
version:
description: Override the autogenerated version.
required: false
default: ''
type: string
jobs:
update-release:
name: Render changelog and create/update PR
runs-on: ubuntu-24.04
if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Set up Python 3.10
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version: '3.10'
- name: Install project
run: |
python -m pip install --upgrade pip
python -m pip install '.[changelog]' pre-commit
- name: Get next version
if: github.event_name == 'push' || inputs.version == ''
id: next-version
run: echo "version=$(python tools/version.py next)" >> "$GITHUB_OUTPUT"
- name: Update CHANGELOG.md
env:
NEXT_VERSION: ${{ (github.event_name == 'workflow_dispatch' && inputs.version != '') && inputs.version || steps.next-version.outputs.version }}
run: towncrier build --yes --version "${NEXT_VERSION}"
- name: Run pre-commit once to remove trailing whitespace
run: |
python -m pre_commit run --files=CHANGELOG.md || true
- name: Create/update release PR
uses: peter-evans/create-pull-request@5e914681df9dc83aa4e4905692ca88beb2f9e91f # v7.0.5
with:
commit-message: Release v${{ (github.event_name == 'workflow_dispatch' && inputs.version != '') && inputs.version || steps.next-version.outputs.version }}
branch: release/auto
sign-commits: true
title: Release v${{ (github.event_name == 'workflow_dispatch' && inputs.version != '') && inputs.version || steps.next-version.outputs.version }}
body: |
This automated PR builds the latest changelog. When merged, a new release is published automatically.
Before merging, please ensure it's based on the most recent default branch HEAD.
If you want to rebuild this PR with a custom version or the current date, you can also trigger the corresponding workflow manually in `Actions` > `Prepare Release PR` > `Run workflow`.
You can still follow the manual release procedure outlined in: https://salt-extensions.github.io/salt-extension-copier/topics/publishing.html