Create release PR and generate changelog #28
Workflow file for this run
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 | |
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 }} | |
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: Create "changelog_artifacts.md" | |
# Write multiple lines input stream | |
run: | | |
cat > ${{ env.FILE }} <<'EOF' | |
${{ steps.github_release.outputs.changelog }} | |
- name: Upload "changelog_artifacts.md" | |
uses: actions/upload-artifact@master | |
with: | |
name: release-changelog-artifacts | |
path: ${{ env.FILE }} | |
- name: Create release PR | |
run: | | |
changelog='${{ steps.github_release.outputs.changelog }}' | |
gh pr create --base master --head ${{ github.ref_name }} --title "Release by ${{ env.DATE }}" --body "# Release Notes | |
$changelog" | |