mirror of
https://github.com/Paillat-dev/svelte-github-calendar.git
synced 2026-03-03 02:44:55 +00:00
57 lines
1.5 KiB
YAML
57 lines
1.5 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: 10
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '24'
|
|
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"
|
|
|
|
if [[ $VERSION =~ - ]]; then
|
|
TAG=$(echo $VERSION | sed -E 's/.*-([^.]+).*/\1/')
|
|
echo "tag=$TAG" >> $GITHUB_OUTPUT
|
|
echo "Prerelease detected, using tag: $TAG"
|
|
else
|
|
echo "tag=latest" >> $GITHUB_OUTPUT
|
|
echo "Stable release, using tag: latest"
|
|
fi
|
|
|
|
- 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 --no-git-checks --tag ${{ steps.version.outputs.tag }}
|