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 == 'GoodM4ven' # ! Hard-coded username | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Install GitHub CLI | |
run: | | |
curl -fsSL https://cli.github.com/packages/github-cli-archive-keyring.gpg | sudo gpg --dearmor -o /usr/share/keyrings/github-cli-archive-keyring.gpg | |
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/github-cli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null | |
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 |