ios-templates
ios-templates copied to clipboard
Automate Release Pull Request Creation Process
Why
We can improve the workflow by automating the process of creating release pull requests, including building the changelog, creating a release branch, and creating the pull request. This will streamline the process and make it more efficient for the team.
Acceptance Criteria
- The
create_release_pull_request.yml
workflow file is created and added to the repository. - The workflow is triggered when a GitHub Actions workflow dispatch event is received, with the version name passed as an input parameter.
- The
.github/workflows/configs/changelog-config.json
file used for the changelog configuration.
Example:
create_release_pull_request.yml
name: Create Release Pull Request
on:
workflow_dispatch:
inputs:
newVersion:
description: "Version name"
required: true
type: string
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
create_release_pull_request:
name: Create Release Pull Request
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Find HEAD commit
id: head
run: echo "sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
- name: Build changelog
id: changelog
uses: mikepenz/release-changelog-builder-action@v4
with:
configuration: ".github/workflows/configs/changelog-config.json"
toTag: ${{ steps.head.outputs.sha }}
token: ${{ secrets.GITHUB_TOKEN }}
- name: Create Release branch
uses: peterjgrainger/[email protected]
with:
branch: release/${{ github.event.inputs.newVersion }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create pull request
run: gh pr create --draft -B main -H release/${{ github.event.inputs.newVersion }} -t 'Release - ${{ github.event.inputs.newVersion }}' -b "${{ steps.changelog.outputs.changelog }}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
changelog-config.json
{
"categories": [
{
"title": "## ✨ Features",
"labels": [
"type : feature"
]
},
{
"title": "## 🐛 Bug fixes",
"labels": [
"type : bug"
]
},
{
"title": "## 🧹 Chores",
"labels": [
"type : chore"
]
},
{
"title": "## Others",
"exclude_labels": [
"type : feature",
"type : bug",
"type : chore",
"type : release"
]
}
],
"max_pull_requests": 200
}
Who Benefits?
- Users