Skip to content

Release package

Release package #28

Workflow file for this run

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: [18.9.x]
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Install pnpm
uses: pnpm/action-setup@v2
id: pnpm-install
with:
version: ^8.6.0
run_install: false
- 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: Get pnpm store directory
id: pnpm-cache
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- name: Setup pnpm cache
uses: actions/cache@v3
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install
- 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 }}