Skip to content

Release and Publish

Release and Publish #9

Workflow file for this run

name: Release and Publish
on:
workflow_dispatch:
inputs:
bump:
description: Version Bump
type: choice
default: ''
options:
- ''
- major
- minor
- patch
required: false
preRelease:
description: preRelease Label
required: false
jobs:
release_and_publish:
runs-on: ubuntu-latest
env:
VERSION_BUMP: ${{ inputs.bump }}
PRE_RELEASE: ${{ inputs.preRelease }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 20
registry-url: 'https://registry.npmjs.org'
- run: corepack enable
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
- name: Restore node_modules from cache
uses: actions/cache@v4
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install node_modules
run: yarn install --frozen-lockfile
- name: git config
run: |
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
- name: release-it
shell: bash
run: |
PRE_RELEASE_ARG=([[ -n "${PRE_RELEASE}" ]] && "--preRelease=${PRE_RELEASE}" || "")
CMD="yarn release ${VERSION_BUMP} ${PRE_RELEASE_ARG} --ci --npm.skipChecks"
echo "${CMD}"