Files
svelte-github-calendar/.github/workflows/publish.yaml

50 lines
1.2 KiB
YAML

name: Publish to NPM
on:
workflow_call:
jobs:
publish:
name: Publish to NPM
runs-on: ubuntu-latest
environment: npm
permissions:
id-token: write
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 9
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'pnpm'
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Extract version from tag
id: version
run: |
VERSION=${GITHUB_REF#refs/tags/v}
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Publishing version: $VERSION"
- name: Update package.json version
run: |
pnpm version ${{ steps.version.outputs.version }} --no-git-tag-version
- name: Build package
run: pnpm build
- name: Publish to NPM
run: pnpm publish --access public --provenance --no-git-checks
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}