Git Product home page Git Product logo

bump-version's Introduction

Bump Version

This GitHub Actions, get the value of tag, and pass to the application, replacing the static version in package.json, automatically, without create a new commit and manually change the version.

This action, works only with push event of type tags

Example:

on:
  push:
    tags:
      - 'v[0-9]+.[0-9]+.[0-9]+'

If you use this action with a worflow that run without this trigger, this step will break.

Supported Languages

At the moment, just support package.json that need exist in root folder

Examples

name: Deploy Package to NPM

on:
  push:
    tags:
      - 'v[0-9]+.[0-9]+.[0-9]+'

jobs:
  publish_npm:
    name: Publishing to NPM

    runs-on: ubuntu-latest

    permissions:
      actions:
        write
      contents:
        write

    steps:
      - uses: actions/checkout@v3

      - name: Setup NodeJs
        uses: actions/setup-node@v3
        with:
          node-version: x.y # Version that you want use here
          registry-url: https://registry.npmjs.org/
                    
      - name: Install Packages
        run: yarn

      - name: Bump Version of package.json
        uses: ramonpaolo/[email protected]
        with: 
          tag: ${{ github.ref_name }} # Accessing the context and get the reference_name, that in this case, is the tag that you created(ex: v1.0.0)
          commit: true
          branch_to_push: 'main'

      - name: Publish package to NPM
        run: npm publish
        env:
          NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} # NPM Token necessary to deploy packages on pipelines CI/CD

Input parameters

Name Description Required Default
tag The tag created(v.*.*.*) true "v1.0.0"
commit Commit the bump false false
branch_to_push Which branch to push false "main"

Output parameters

Name Description
parsed-tag v1.0.0(input) = 1.0.0(output)

bump-version's People

Contributors

ramonpaolo avatar

Stargazers

 avatar Mauro Cettiga avatar David Fernando avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.