-
Notifications
You must be signed in to change notification settings - Fork 245
71 lines (69 loc) · 2.78 KB
/
pre-release.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
66
67
68
69
70
71
name: Draft release pull request
on:
workflow_dispatch:
inputs:
version:
description: "Select version bump"
default: "minor"
type: choice
options:
- major
- minor
- patch
- alpha
- beta
- preview
- dev
jobs:
generate-changelog:
name: Create a PR to update version and release notes
runs-on: sfdc-ubuntu-latest
steps:
- uses: actions/checkout@main
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: 3.8
cache: pip
- name: Install build tool
run: python -m pip install hatch
- name: Bump version
run: hatch version $VERSION
env:
VERSION: ${{ inputs.version }}
- name: Generate release notes
id: changelog
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
PREVIOUS_VERSION=$(gh release view --json tagName --jq .tagName)
NEXT_VERSION="v$(hatch version)"
echo "## $NEXT_VERSION ($(date -I))" > changelog.md
gh api \
--method POST \
-H "Accept: application/vnd.github.v3+json" \
/repos/SFDO-Tooling/CumulusCI/releases/generate-notes \
-f previous_tag_name=$PREVIOUS_VERSION \
-f target_commitish='main' \
-f tag_name=$NEXT_VERSION \
--jq '.body' |
sed -e 's_\(https.*\/\)\([0-9]*\)$_[#\2](\1\2)_' \
-e 's_by @\(.*\) in_by [@\1](https://github.com/\1) in_' >> changelog.md
python utility/update-history.py
- name: Lint history
run: |
npm install prettier
npx prettier --write docs/history.md
- name: Commit changes
run: |
git config user.name github-actions[bot]
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
git switch -c "release-$(hatch version)"
git add docs/history.md cumulusci/__about__.py
git commit -m "Update changelog (automated)"
git push origin "release-$(hatch version)"
- name: Commit changes and open PR
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr create --title "Release v$(hatch version)" --fill --label 'auto-pr'