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
name: Create Release and Auto Merge | |
on: | |
push: | |
tags: | |
- 'v*.*.*' # ? This will match tags like v2.0.1, v1.2.3, etc. | |
jobs: | |
process: | |
if: github.actor == '[email protected]' # ! Hard-coded | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Install GitHub CLI | |
run: | | |
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-key C99B11DEB97541F0 | |
sudo apt-add-repository https://cli.github.com/packages | |
sudo apt update | |
sudo apt install gh | |
- name: Merge PR | |
run: | | |
PR_NUMBER=$(gh pr list --base main --state open --author [email protected] --json number --jq '.[0].number') | |
if [[ ! -z "$PR_NUMBER" ]]; then | |
gh pr merge $PR_NUMBER --merge | |
fi | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract release notes | |
run: | | |
echo "${{ github.event.head_commit.message }}" | sed '1d' > .github/release_body.md | |
- name: Create GitHub Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: ${{ github.ref }} | |
body_path: .github/release_body.md | |
draft: false | |
prerelease: false |