Skip to content

Create Release PR

Create Release PR #2

name: Create Release PR
on:
workflow_dispatch:
inputs:
version_increment:
description: 'Version Increment Type'
type: choice
required: true
options: [ 'major', 'minor', 'patch', 'premajor', 'preminor', 'prepatch', 'prerelease' ]
default: 'patch'
preid:
description: 'The "prerelease prefix" (alpha, beta, rc. ...)'
type: string
required: false
default: ''
draft:
description: 'Release as Draft'
type: boolean
required: false
default: true
env:
GIT_USER_NAME: 'Luis Zurro de Cos'
GIT_USER_EMAIL: '[email protected]'
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/[email protected]
with:
persist-credentials: false
fetch-depth: 0
- name: Bump version
run: echo "NEW_VERSION=$(npm version ${{ github.event.inputs.version_increment }} --preid '${{ github.event.inputs.preid }}' --no-git-tag-version)" >> $GITHUB_ENV
- name: Import GPG key
uses: crazy-max/[email protected]
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.PASSPHRASE }}
git_user_signingkey: true
git_commit_gpgsign: true
git_committer_name: ${{ env.GIT_USER_NAME }}
git_committer_email: ${{ env.GIT_USER_EMAIL }}
- name: Create Pull Request
uses: peter-evans/[email protected]
with:
token: ${{ secrets.PAT }}
committer: ${{ env.GIT_USER_NAME }} <${{ env.GIT_USER_EMAIL }}>
commit-message: "Release ${{ env.NEW_VERSION }}"
branch: "release/${{ env.NEW_VERSION }}"
body: "This is a new release ${{ env.NEW_VERSION }}"
title: "Release ${{ env.NEW_VERSION }}"
labels: release-pr
base: "main"
draft: ${{ github.event.inputs.draft }}