Skip to content

Created new calendarMonthViewType #18

Created new calendarMonthViewType

Created new calendarMonthViewType #18

# Alternative workflow: Publish on every commit to main
# Rename this file to npm-publish-main.yml if you want to use this approach instead
name: Publish to NPM (Auto)
on:
push:
branches: [main]
paths:
- 'js/**'
- 'css/**'
- 'package.json'
workflow_dispatch: # Add this to enable manual triggers
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
registry-url: 'https://registry.npmjs.org'
- name: Check if version changed
id: version-check
run: |
CURRENT_VERSION=$(npm show simple-calendar-js version 2>/dev/null || echo "0.0.0")
PACKAGE_VERSION=$(node -p "require('./package.json').version")
echo "current_version=$CURRENT_VERSION" >> $GITHUB_OUTPUT
echo "package_version=$PACKAGE_VERSION" >> $GITHUB_OUTPUT
if [ "$CURRENT_VERSION" != "$PACKAGE_VERSION" ]; then
echo "version_changed=true" >> $GITHUB_OUTPUT
else
echo "version_changed=false" >> $GITHUB_OUTPUT
fi
- name: Verify package (if publishing)
if: steps.version-check.outputs.version_changed == 'true'
run: |
echo "Publishing version: $(node -p "require('./package.json').version")"
echo "Current NPM version: ${{ steps.version-check.outputs.current_version }}"
- name: Publish to NPM
if: steps.version-check.outputs.version_changed == 'true'
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}