Skip to content

fix(release): build before releasing package #6

fix(release): build before releasing package

fix(release): build before releasing package #6

Workflow file for this run

name: Release NPM package
on:
push:
branches:
- master
jobs:
release:
runs-on: ubuntu-latest
steps:
# Checkout project repository
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
# Setup git profile
- name: git config
run: |
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
# Setup Node.js environment
- name: Setup Node.js
uses: actions/setup-node@v3
with:
registry-url: https://registry.npmjs.org/
node-version: 18
# Install pnpm
- uses: pnpm/action-setup@v2
name: Install pnpm
id: pnpm-install
with:
version: 8
run_install: false
# Setup pnpm store
- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
# Use cache to reduce installation time
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
# Install dependencies
- name: Install dependencies
run: pnpm install
# Tests
- name: Run tests
run: pnpm test
# Setup NPM
- name: Create .npmrc
run: npm config set //registry.npmjs.org/:_authToken $NPM_TOKEN
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
# Publish version to public repository
- name: Release
run: npx release-it --ci
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}