Update from release/5.4.2 #23
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
name: Tag and Release on PR Merge | |
on: | |
pull_request: | |
types: [closed] | |
# branches: | |
# - 'release/*' | |
jobs: | |
tag-and-release: | |
runs-on: ubuntu-latest | |
if: github.event.pull_request.merged == true | |
steps: | |
- name: Get Release Branch Name | |
id: get_release_branch_name | |
run: echo "branch_name=${{ github.head_ref }}" >> $GITHUB_OUTPUT | |
- name: Echo Release Branch Name | |
id: echo_release_branch_name | |
run: echo '${{ steps.get_release_branch_name.outputs.branch_name }}' | |
- name: Get Merge sha | |
id: get_merge_sha | |
run: echo "merge_sha=${{ github.sha }}" >> $GITHUB_OUTPUT | |
- name: Echo Merge sha | |
id: echo_merge_sha | |
run: echo '${{ steps.get_merge_sha.outputs.merge_sha }}' | |
- name: Create Tag Variable | |
id: create_tag_variable | |
if: contains(steps.get_release_branch_name.outputs.branch_name, 'release/') | |
run: | | |
BRANCH=${{ steps.get_release_branch_name.outputs.branch_name }} | |
TAG="$(sed 's/release\///g' <<< $BRANCH)" | |
echo "tag=$TAG" >> $GITHUB_OUTPUT | |
- name: Echo Tag Name | |
id: echo_tag_name | |
run: echo "${{ steps.create_tag_variable.outputs.tag }}" | |
- uses: actions/checkout@v2 | |
- name: Get Release Notes | |
id: get_release_notes | |
# Get changelog, then filter version header, MOB ticket #, and pull request links. | |
run: | | |
NOTES="$(sed -e "/^#### Version ${{ steps.create_tag_variable.outputs.tag }}/,/^#### /! d" -e "/^#### .*/d" -e 's/(\[.*].*//' -e 's/\*\*.*:\*\*//' CHANGELOG.md)" | |
echo "notes<<EOF" >> $GITHUB_OUTPUT | |
echo "$NOTES" >> $GITHUB_OUTPUT | |
echo "EOF" >> $GITHUB_OUTPUT | |
- name: Echo Release Notes | |
id: echo_release_notes | |
run: echo "${{ steps.get_release_notes.outputs.notes }}" | |
- name: Tag Release | |
id: tag_release | |
uses: tvdias/[email protected] | |
with: | |
repo-token: "${{ secrets.GITHUB_TOKEN }}" | |
tag: "${{ steps.create_tag_variable.outputs.tag }}" | |
commit-sha: "${{ steps.get_merge_sha.outputs.merge_sha }}" | |
- name: Create Release | |
id: create_release | |
uses: softprops/action-gh-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token | |
with: | |
tag_name: ${{ steps.create_tag_variable.outputs.tag }} | |
name: ${{ steps.create_tag_variable.outputs.tag }} | |
body: ${{ steps.get_release_notes.outputs.notes }} | |
draft: false | |
prerelease: false |