Skip to content

Commit

Permalink
Add NPM publish GitHub workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
HuakunShen committed Feb 7, 2025
1 parent 4e036db commit b24d018
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 1 deletion.
36 changes: 36 additions & 0 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: NPM Package Publish

on:
push:
branches: [main]
release:
types: [created]
workflow_dispatch:

jobs:
publish-npm:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
- uses: actions/setup-node@v4
with:
node-version: "22.x"
registry-url: "https://registry.npmjs.org"
- run: bun install
- run: bun run build
- name: Check if version is already published
run: |
PACKAGE_VERSION=$(node -p "require('./package.json').version")
PACKAGE_NAME=$(jq -r '.name' package.json)
npm view $PACKAGE_NAME@$PACKAGE_VERSION
continue-on-error: true
id: check_version
- name: Publish
if: steps.check_version.outcome != 'success'
run: npm publish --provenance --access public
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://schema.kunkun.sh",
"name": "kunkun-ext-speech-to-text",
"version": "0.0.7",
"version": "0.0.8",
"license": "MIT",
"kunkun": {
"name": "Speech to Text",
Expand Down

0 comments on commit b24d018

Please sign in to comment.