Make release #21
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 | |
on: | |
workflow_dispatch: | |
inputs: | |
mode: | |
description: 'Release version type' | |
required: true | |
type: choice | |
default: 'minor' | |
options: | |
- patch | |
- minor | |
- major | |
jobs: | |
create-release: | |
name: Release | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20.x' | |
cache: 'yarn' | |
- name: Install dependencies | |
run: yarn install --frozen-lockfile | |
- name: Setup 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: | | |
npx ts-node ./scripts/release.ts \ | |
--release-as ${{ 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: Release ${{ steps.generate_body.outputs.tag_name }} | |
tag: ${{ steps.generate_body.outputs.tag_name }} | |
body: ${{ steps.get-pr-body.outputs.body }} | |
token: ${{ secrets.GITHUB_TOKEN }} |