Skip to content

Merge pull request #3 from kiranojhanp/0.0.10 #5

Merge pull request #3 from kiranojhanp/0.0.10

Merge pull request #3 from kiranojhanp/0.0.10 #5

Workflow file for this run

name: Publish to NPM
on:
push:
branches:
- master
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies
run: npm ci
- name: Get version from package.json
id: package-version
uses: martinbeentjes/[email protected]
- name: Check if version exists
id: version-check
run: |
if npm view ${{ github.event.repository.name }}@${{ steps.package-version.outputs.current-version }} version; then
echo "Version already exists"
exit 1
fi
continue-on-error: true
- name: Generate Changelog
id: changelog
uses: TriPSs/conventional-changelog-action@v5
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
git-message: 'chore(release): {version}'
git-user-name: 'GitHub Action'
git-user-email: '[email protected]'
version-file: './package.json'
skip-version-file: true
skip-git-pull: true
skip-commit: true
- name: Build
run: npm run build
- name: Publish to NPM
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Create GitHub Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ steps.package-version.outputs.current-version }}
release_name: Release v${{ steps.package-version.outputs.current-version }}
body: ${{ steps.changelog.outputs.clean_changelog }}
draft: false
prerelease: false