Create release PR and generate changelog #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Default based by dev branch | |
name: Create release PR and generate changelog | |
on: | |
workflow_dispatch: | |
inputs: | |
from-tag: | |
description: '' | |
required: false | |
to-tag: | |
description: '' | |
required: false | |
jobs: | |
release-pr: | |
name: Create release PR with changelog | |
runs-on: ubuntu-22.04 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} | |
permissions: | |
contents: read | |
pull-requests: read | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
show-progress: false | |
fetch-depth: 0 | |
- name: Computed envs | |
run: | | |
echo "DATE=$(date +'%d.%m.%Y')" >> $GITHUB_ENV | |
echo "FROM_TAG=$(git merge-base --fork-point origin/master)" >> $GITHUB_ENV | |
echo "FILE=${{ github.workspace }}/changelog_artifacts.md" >> $GITHUB_ENV | |
- name: Build Changelog | |
id: github_release | |
uses: mikepenz/[email protected] | |
with: | |
fromTag: ${{ github.event.inputs.from-tag || env.FROM_TAG }} | |
toTag: ${{ github.event.inputs.to-tag }} | |
configuration: "./.github/changelog-builder-config.json" | |
- name: List pull request | |
# List merged pull request into dev branch | |
run: echo "pull_requests --> ${{ steps.github_release.outputs.pull_requests }}" | |
- name: Install dependencies | |
run: | | |
cd .github/actions/processing-release-changelog | |
npm ci | |
- name: Processing changelog data | |
id: changelog | |
uses: ./.github/actions/processing-release-changelog | |
with: | |
data: | | |
${{ steps.github_release.outputs.changelog }} | |
- name: Create release PR | |
run: | | |
changelog='${{ steps.changelog.outputs.changelog }}' | |
gh pr create --base master --head ${{ github.ref_name }} --title "Release by ${{ env.DATE }}" --body "$changelog" |