name: Release on: push: tags: - 'v*' workflow_dispatch: inputs: version: description: 'Version to release (e.g., v2.0.0)' required: true type: string jobs: release: runs-on: ubuntu-latest permissions: contents: write steps: - name: Checkout uses: actions/checkout@v4 - name: Create GitHub Release uses: softprops/action-gh-release@v1 with: name: ${{ github.ref_name || inputs.version }} tag_name: ${{ github.ref_name || inputs.version }} generate_release_notes: true publish-npm: needs: release runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: '20' registry-url: 'https://registry.npmjs.org' - name: Update package version run: | VERSION="${{ github.ref_name || inputs.version }}" VERSION="${VERSION#v}" npm version $VERSION --no-git-tag-version --allow-same-version - name: Publish to npm run: npm publish env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}