Release from main #143
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: Release | |
run-name: 'Release from ${{ github.ref_name }}' | |
on: | |
workflow_dispatch: | |
inputs: | |
type: | |
description: | | |
Select the branch to release from above, then select the version level to bump below. | |
type: choice | |
options: | |
- major | |
- minor | |
- patch | |
default: minor | |
jobs: | |
bump-version: | |
runs-on: ubuntu-latest | |
outputs: | |
RELEASE_VERSION: ${{ steps.create_tags.outputs.RELEASE_VERSION }} | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '20.x' | |
- run: npm ci | |
- name: Bump version and regenerate README | |
id: create_tags | |
run: | | |
# https://github.com/orgs/community/discussions/26560 | |
git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git config user.name "github-actions[bot]" | |
VERSION=$(npm version ${{inputs.type}} --no-git-tag-version) | |
npx oclif readme && node src/format-readme.js | |
git checkout -b release/${VERSION} | |
echo "RELEASE_VERSION=${VERSION}" >> $GITHUB_OUTPUT | |
- name: Create release PR | |
run: | | |
git commit \ | |
-am "Release of ${VERSION}" | |
git push --set-upstream origin | |
gh pr create --base main --head release/${VERSION} --title "Release v${VERSION}" --body "Release of CLI version ${VERSION}" | |
echo "Release version ${VERSION} PR created" >> $GITHUB_STEP_SUMMARY |