Skip to content

fix workflow

fix workflow #5

Workflow file for this run

name: Publish package
on:
push:
tags:
- "v*"
jobs:
build:
name: Test and build
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup node & npm
uses: actions/setup-node@v4
with:
node-version: 20
- name: Setup pnpm
uses: pnpm/action-setup@v3
with:
version: 9.1.0
- run: pnpm install
- name: Run tests
run: pnpm test
- name: Build
run: pnpm build
- name: Cache build artifacts
uses: actions/cache@v4
with:
path: "**/dist"
key: build-artifacts-${{ github.sha }}
publish:
name: Publish to NPM
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Restore build artifacts
uses: actions/cache@v4
with:
path: "**/dist"
key: build-artifacts-${{ github.sha }}
- name: Setup node & npm
uses: actions/setup-node@v3
with:
node-version: 20
- name: Publish to NPM
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
npm config set "//registry.npmjs.org/:_authToken" "${NPM_TOKEN}"
npm -r publish . --access=public --no-git-checks
create-release:
name: Create Release
runs-on: ubuntu-latest
needs: publish
permissions: write-all
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
body: |
Version ${{ github.ref }}
draft: false
prerelease: false