Make release #26
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: Make release | |
on: | |
workflow_dispatch: | |
inputs: | |
mode: | |
description: 'Release type' | |
required: true | |
type: choice | |
default: 'patch' | |
options: | |
- patch | |
- minor | |
- major | |
jobs: | |
create-release: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [ 20 ] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup pnpm | |
uses: pnpm/action-setup@v3 | |
with: | |
version: 9.1.1 | |
- name: Setup Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: 'pnpm' | |
- name: Install dependencies | |
run: pnpm install | |
- name: Config git | |
run: | | |
git config user.name github-actions[bot] | |
git config user.email 41898282+github-actions[bot]@users.noreply.github.com | |
- name: Run release | |
id: run-release | |
run: | | |
pnpm release:${{ github.event.inputs.mode }} | |
echo "new_version=$(node -p "require('./projects/lib/package.json').version")" >> $GITHUB_OUTPUT | |
- name: Generate Release body | |
id: generate_body | |
run: | | |
npx extract-changelog-release > RELEASE_BODY.md | |
echo "tag_name=$(git describe --abbrev=0 --tags)" >> $GITHUB_OUTPUT | |
- name: Get PR body | |
id: get-pr-body | |
run: | | |
body=$(cat RELEASE_BODY.md) | |
delimiter="$(openssl rand -hex 8)" | |
echo "body<<$delimiter" >> $GITHUB_OUTPUT | |
echo "$body" >> $GITHUB_OUTPUT | |
echo "$delimiter" >> $GITHUB_OUTPUT | |
- name: Create Pull Request | |
uses: peter-evans/create-pull-request@v6 | |
with: | |
delete-branch: true | |
token: ${{ secrets.GITHUB_TOKEN }} | |
branch: release/${{ steps.run-release.outputs.new_version }} | |
title: '🚀 Release v${{ steps.run-release.outputs.new_version }}' | |
body: | | |
${{ steps.get-pr-body.outputs.body }} | |
- name: Create GitHub Release | |
uses: ncipollo/release-action@v1.14.0 | |
with: | |
name: ${{ steps.generate_body.outputs.tag_name }} | |
tag: ${{ steps.generate_body.outputs.tag_name }} | |
body: ${{ steps.get-pr-body.outputs.body }} | |
token: ${{ secrets.GITHUB_TOKEN }} |