Skip to content

chore: bump version to publish webhook types (#386) #344

chore: bump version to publish webhook types (#386)

chore: bump version to publish webhook types (#386) #344

name: "Publish v2 to npm 🚀"
on:
push:
branches:
- main
paths:
- package.json
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: "20"
- name: Install dependencies
run: npm install --ignore-scripts
- name: Build
run: npm run build
- name: Set npm Config
run: npm config set //registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}
- name: Publish v2 to npm
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Extract version from package.json
id: package-version
run: echo "version=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT
- name: Create GitHub Release
run: |
if gh release view "v${{ steps.package-version.outputs.version }}" &> /dev/null; then
echo "Release v${{ steps.package-version.outputs.version }} already exists"
else
gh release create "v${{ steps.package-version.outputs.version }}" \
--title "v${{ steps.package-version.outputs.version }}" \
--generate-notes
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}