Release #20
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 | |
on: | |
workflow_dispatch: | |
inputs: | |
type: | |
type: choice | |
description: Choose release type | |
options: | |
- auto | |
- patch | |
- minor | |
- major | |
default: auto | |
beta: | |
type: boolean | |
description: Prerelease | |
default: false | |
dry: | |
type: boolean | |
description: Dry release | |
default: false | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
issues: write | |
pull-requests: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set git config | |
run: | | |
git config user.name "${GITHUB_ACTOR}" | |
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" | |
- name: Set up node | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: '.nvmrc' | |
cache: "npm" | |
cache-dependency-path: package-lock.json | |
- name: Install dependencies | |
run: npm ci --ignore-scripts --progress=false --fund=false --fetch-retries=5 | |
- name: Release | |
run: npm run release -- --ci --verbose $TYPE_ARG $BETA_ARG $DRY_ARG $GIT_ARG | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
TYPE_ARG: ${{ fromJSON('{"auto":"", "patch":"-i patch", "minor":"-i minor", "major":"-i major"}')[github.event.inputs.type] }} | |
BETA_ARG: ${{ github.event.inputs.beta == 'true' && '--preRelease=beta' || '' }} | |
DRY_ARG: ${{ github.event.inputs.dry == 'true' && '--dry-run' || '' }} | |
GIT_ARG: --no-git | |
- name: Determine new version | |
id: version | |
run: | | |
NEW_VERSION="$(cat package.json | jq -r '.version')" | |
echo "release-version=${NEW_VERSION}" >> $GITHUB_OUTPUT | |
- name: Create PR | |
uses: peter-evans/create-pull-request@70a41aba780001da0a30141984ae2a0c95d8704e | |
if: ${{ github.event.inputs.dry == 'false' }} | |
with: | |
base: main | |
branch: release | |
title: Release ${{ steps.version.outputs.release-version }} | |
commit-message: "chore: Release v${{ steps.version.outputs.release-version }}" | |
labels: ocff:release |