Skip to content

Draft release pull request #40

Draft release pull request

Draft release pull request #40

Workflow file for this run

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: SFDO-Tooling-Ubuntu
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'