1.1.39 #56
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: | |
# Trigger when a new release is published or when a tag is pushed | |
push: | |
tags: | |
- 'v*.*.*' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
# Step 1: Checkout the code | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
# Step 2: Set up Node.js | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20' # Adjust Node.js version as needed | |
registry-url: https://registry.npmjs.org/ | |
# Step 3: Install dependencies | |
- name: Install dependencies | |
run: npm ci | |
# Step 4: Run lint (optional, but recommended) | |
- name: Run lint | |
run: npm run lint | |
# Step 5: Run tests (optional, but recommended) | |
- name: Run tests | |
run: npm test | |
# Step 6: Build the package | |
- name: Build the package | |
run: npm run build | |
# Step 7: Publish to npm | |
- name: Publish to npm | |
run: npm publish | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
# Step 8: Create a GitHub release (optional) | |
- name: Create GitHub Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: ${{ github.ref_name }} | |
name: ${{ github.ref_name }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |