npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

npm-semantic-publish

v1.35.0

Published

GitHub action to publish npm packages with semanantic versioning rules

Downloads

204

Readme

GitHub action to publish npm packages with semanantic versioning rules

CI CodeQL Lint Codebase Check Transpiled JavaScript NPM Version Downloads Coverage

Marketplace

Follow me, and consider starring the project to show your :heart: and support.

Table of Contents

This action allow your project to create a new release, based on semantic versionig principles, and publish it to your npm registry.

Semantic versioning over commit message

To generate a new version (git tag and npm package publishing), you have just to add to the commit message one of the following key:

  • [MAJOR] or [major]: new major release, e.g. v1.0.0 -> v2.0.0 will be executed
    • git commit -m "add best feature ever [major]"
  • [PATCH] or [patch]: new patch release, e.g. v1.0.0 -> v1.0.1 will be executed
    • git commit -m "fix best feature ever [patch]"
  • without any of the above keywords a new minor release will be executed, e.g. v1.0.0 -> v1.1.0
    • git commit -m "update best feature ever"

An new release is only exeuted on the defined target-branch (see Action Usage)

Action usage

Action Parameters

See action.yml

| Name | Type | Default | Description | | :-----------: | :----: | :-----: | :----------------------------------------: | | target-branch | string | master | Branch name new release should be executed | | provenance | string | false | NPM package provenance |

:heavy_exclamation_mark: When the Action Parameter provenance is set to true the id-token permission must be set to write:

permissions:
  id-token: write

Complete action example

on:
  push:
    branches: master #the branch name must be the same of **target-branch**

jobs:
  publish:
    runs-on: ubuntu-latest
    permissions:
      contents: write #allow to push on git repo
      id-token: write #allow to publish npm package
    steps:
      - name: Checkout
      id: checkout
      uses: actions/checkout@v4 #checkout git repo
      uses: actions/setup-node@v4 #setup node env
      with:
        node-version: 20.x
        registry-url: 'https://registry.npmjs.org'
    - name: Run my Action
      id: run-action
      uses: iuccio/[email protected] #execute npm semver publish
      with:
        target-branch: master
        provenance: true
      env:
        NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} #npm token

Action configuration Step-by-Step

Step1 - Secrets Configuration

This action requires the NPM_TOKEN secret configuretion:

  1. generate a new npm token able to publish Creating and viewing access tokens
  2. add the above generated token in the secret NPM_TOKEN (see Using secrets in GitHub Actions)

Step 2

Add permissions to to push on git and publish on npm

permissions:
  contents: write
  id-token: write

Step 3

Add to the checkout action:

uses: actions/checkout@v4

Step 4

Add an actions/setup-node step to your workflow. If you have one already, ensure that the registry-url input is set (e.g. to https://registry.npmjs.org) so that this action can populate your .npmrc with authentication info:

uses: actions/setup-node@v4
with:
  node-version: 20.x
  registry-url: 'https://registry.npmjs.org'

Step 5

add actions/npm-semver-publish step:

name: Run my Action
id: run-action
uses: iuccio/[email protected]
with:
  target-branch: 'master' #where a new release is applied
  provenance: true #if you want to publish on npm registry the provenance
env:
  NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

That's it!

Development

See Development for more information.

License

CSVtoJSON is licensed under the GNU General Public License v3.0 License.

Buy me a Coffee

Just if you want to support this repository:

  • BTC tip address: 37vdjQhbaR7k7XzhMKWzMcnqUxfw1njBNk