Merge pull request #26 from formsible/feat/components #29
Workflow file for this run
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 to NPM | |
on: | |
push: | |
tags: | |
- '*' # Triggers on all tag pushes | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
# Step 1: Checkout code | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
# Step 2: Setup Node.js (v20) | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '20' | |
# Step 3: Install pnpm | |
- name: Install pnpm | |
run: | | |
npm install -g pnpm | |
pnpm --version # Verify that pnpm is installed and accessible | |
# Step 4: Install dependencies using pnpm | |
- name: Install dependencies | |
run: pnpm install | |
# Step 5: Run tests (replace with your actual test command) | |
- name: Run tests | |
run: pnpm run test | |
# Step 6: Build the library (replace with your actual build command) | |
- name: Build the library | |
run: pnpm run build | |
# Step 7: Set version to the Git tag version | |
- name: Set NPM version from Git tag | |
run: | | |
TAG_NAME=${GITHUB_REF#refs/tags/} # Extract tag name from GITHUB_REF | |
npm version "$TAG_NAME" --no-git-tag-version # Set npm version to tag name without creating a new git tag | |
# Step 8: Publish to NPM (on successful build) | |
- name: Publish to NPM | |
uses: JS-DevTools/npm-publish@v3 | |
with: | |
token: ${{ secrets.NPM_TOKEN }} |