Skip to content

Prepare Release

Prepare Release #2

name: Prepare Release
on:
workflow_dispatch:
inputs:
releaseType:
description: 'Release type (one of): patch, minor, major'
required: true
type: choice
options:
- patch
- minor
- major
jobs:
prepare-release:
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
token: ${{ env.HEXANCORE_BOT_TOKEN }}
env:
HEXANCORE_BOT_TOKEN: ${{ secrets.HEXANCORE_BOT_TOKEN }}
- name: Configure Git user
run: |
git config --global user.email "[email protected]"
git config --global user.name "Hexancore Bot"
- name: Configure GPG
run: |
echo "${{ secrets.HEXANCORE_BOT_GPG_PRIVATE }}" | base64 -d | gpg --import
echo "${{ secrets.HEXANCORE_BOT_GPG_PASS }}" | gpg --passphrase-fd 0 --batch --yes --pinentry-mode loopback --command-fd 0
git config --global commit.gpgsign true
git config --global user.signingkey ${{ secrets.HEXANCORE_BOT_GPG_KEY_ID }}
# Bump version
- name: Bump package version
shell: bash
run: |
yarn version $RELEASE_TYPE
echo "RELEASE_TAG=latest" >> $GITHUB_ENV
echo "NEW_VERSION=$(jq -r '.version' < package.json)" >> $GITHUB_ENV
env:
RELEASE_TYPE: ${{ inputs.releaseType }}
- name: Update CHANGELOG.md
uses: 'zen8sol/[email protected]'
with:
newVersion: '${{ env.NEW_VERSION }}'
# Commit
- name: Commit CHANGELOG.md and package.json changes
shell: bash
run: |
git add "package.json"
git add "CHANGELOG.md"
git commit -m "chore: release ${{ env.NEW_VERSION }}"
git push git push --set-upstream origin chore-prepare-release
- name: Create Pull Request
run: |
curl \
-X POST \
-H "Authorization: token ${{ secrets.HEXANCORE_BOT_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/${{ github.repository }}/pulls \
-d '{"title":"Prepare new version release: ${{ env.NEW_VERSION }}","head":"chore-prepare-release","base":"main","body":"Prepare new version release: ${{ env.NEW_VERSION }}"}'