π Publish: 1. Create Version Release #197
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: ' π Publish: 1. Create Version Release' | |
on: | |
workflow_dispatch: | |
inputs: | |
bump: | |
description: 'Version Bump' | |
type: choice | |
options: | |
- 'patch' | |
- 'minor' | |
- 'major' | |
- 'auto' | |
default: 'auto' | |
required: true | |
prerelease: | |
type: boolean | |
description: Prerelease | |
dry_run: | |
description: 'Dry Run' | |
type: boolean | |
default: true | |
workflow_call: | |
secrets: | |
token: | |
required: true | |
permissions: | |
contents: read | |
env: | |
USE_NEXT: ${{ inputs.prerelease }} | |
BUMP: ${{ (inputs.bump != 'auto' && inputs.prerelease && 'pre') || '' }}${{ (inputs.bump != 'auto' && inputs.bump) || '' }} | |
DRY_RUN: ${{ (inputs.dry_run && '--dry-run') || '' }} | |
jobs: | |
release_version: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Show Inputs | |
env: | |
INPUTS: ${{ toJSON(inputs) }} | |
run: | | |
echo "$INPUTS" | |
echo USE_NEXT: "$USE_NEXT" | |
echo BUMP: "$BUMP" | |
echo DRY_RUN: "$DRY_RUN" | |
- uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a # v2.1.0 | |
# cspell:ignore tibdex | |
if: ${{ !env.DRY_RUN && !inputs.token }} | |
id: generate-token | |
with: | |
app_id: ${{ secrets.AUTOMATION_APP_ID }} | |
private_key: ${{ secrets.AUTOMATION_PRIVATE_KEY }} | |
- name: Setup Token | |
env: | |
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token || secrets.GITHUB_TOKEN }} | |
run: echo GITHUB_TOKEN=$GITHUB_TOKEN >> $GITHUB_ENV | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
token: ${{ env.GITHUB_TOKEN }} # needed to trigger workflows | |
- name: Setup pnpm | |
uses: pnpm/action-setup@v4.0.0 | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
registry-url: 'https://registry.npmjs.org' | |
cache: pnpm | |
- name: Version | |
run: | | |
echo VERSION=$(jq -r .version lerna.json) >> $GITHUB_ENV | |
- name: Mode | |
env: | |
MODE: > | |
${{ (env.USE_NEXT == 'true' && '"--conventional-prerelease=*"') | |
|| (contains(env.VERSION, 'alpha') && '"--conventional-graduate=*"') | |
|| '' | |
}} | |
run: | | |
echo MODE=$MODE >> $GITHUB_ENV | |
- name: Setup Git | |
run: | | |
git config user.name streetsidesoftware[bot] | |
git config user.email streetsidesoftware[bot]@users.noreply.github.com | |
git remote add gh-token "https://${{ env.GITHUB_TOKEN }}@github.com/streetsidesoftware/cspell.git" | |
- name: Install | |
run: pnpm i | |
# - name: Debug | |
# run: | | |
# pnpx envinfo --system --npmPackages '@lerna-lite/*' --binaries --browsers | |
- name: Push Version | |
run: pnpm lerna version ${{ env.BUMP }} --conventional-commits --sync-workspace-lock --changelog-preset conventionalcommits --yes ${{ env.MODE }} ${{ env.DRY_RUN }} | |
# cspell:ignore pnpx envinfo conventionalcommits |