Release package #40
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 package | |
on: | |
workflow_dispatch: | |
inputs: | |
dry-run: | |
description: 'Dry-run' | |
type: boolean | |
default: false | |
required: false | |
pre-release-tag: | |
description: 'Pre-release tag' | |
required: false | |
jobs: | |
release: | |
if: github.ref == 'refs/heads/main' | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [20] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install pnpm | |
uses: pnpm/action-setup@v3 | |
id: pnpm-install | |
with: | |
run_install: false | |
- name: Install NodeJS ${{matrix.node-version}} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{matrix.node-version}} | |
cache: 'pnpm' | |
- name: git config | |
run: | | |
git config user.name "${GITHUB_ACTOR}" | |
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" | |
- name: npm config | |
run: npm config set //registry.npmjs.org/:_authToken $NPM_TOKEN | |
env: | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: Show changes | |
run: git status --porcelain | |
- name: Install dependencies | |
run: pnpm install --frozen-lockfile | |
- name: Show changes after install | |
run: git status --porcelain | |
- name: Release | |
run: | | |
args=() | |
if [ "${{ github.event.inputs.dry-run }}" = true ]; then | |
args+=(--dry-run) | |
fi | |
if [ -n "${{ github.event.inputs.pre-release-tag }}" ]; then | |
args+=(--preRelease=${{ github.event.inputs.pre-release-tag }}) | |
fi | |
pnpm release-it "${args[@]}" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |