Skip to content

fix: npm pkg fix (#3) #10

fix: npm pkg fix (#3)

fix: npm pkg fix (#3) #10

name: Test, Build, and Publish
on:
workflow_dispatch:
push:
permissions:
contents: write
issues: write
pull-requests: write
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 'lts/*'
- name: Install dependencies
run: npm ci
- name: Run tests
run: npm test
build:
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 'lts/*'
- name: Install dependencies
run: npm ci
- name: Audit signatures
run: npm audit signatures
- name: Build library
run: npm run build
- name: Prepare artifact
run: |
mkdir -p ./lib/lib &&
find ./lib -mindepth 1 -maxdepth 1 ! -name "lib" -exec mv {} ./lib/lib/ \;
cp package.json README.md LICENSE ./lib
- uses: actions/upload-artifact@v4
with:
name: lib
path: ./lib
publish:
runs-on: ubuntu-latest
needs: build
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 'lts/*'
- uses: actions/download-artifact@v4
with:
name: lib
path: ./
- name: Publish library
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
npx semantic-release