Skip to content

[fix] GitHub actions permissions of NPM provenance #11

[fix] GitHub actions permissions of NPM provenance

[fix] GitHub actions permissions of NPM provenance #11

Workflow file for this run

name: CI & CD
on:
push:
tags:
- v*
jobs:
Build-and-Publish:
env:
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 9
- uses: actions/setup-node@v4
with:
node-version: 20
registry-url: https://registry.npmjs.org
cache: pnpm
- name: Install Dependencies
run: pnpm i --frozen-lockfile
- name: Build & Publish
run: npm publish --access public --provenance
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Deploy to GitHub pages
uses: peaceiris/actions-gh-pages@v4
with:
publish_dir: ./docs
personal_token: ${{ secrets.GITHUB_TOKEN }}
force_orphan: true
- name: Deploy to Vercel preview
uses: amondnet/vercel-action@v25
if: ${{ env.VERCEL_TOKEN && env.VERCEL_ORG_ID && env.VERCEL_PROJECT_ID }}
with:
vercel-token: ${{ secrets.VERCEL_TOKEN }}
github-token: ${{ secrets.GITHUB_TOKEN }}
vercel-org-id: ${{ secrets.VERCEL_ORG_ID }}
vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }}
working-directory: ./docs
vercel-args: --prod