Code Monkey home page Code Monkey logo

action-update-version's Introduction

๐Ÿท update-version

Update your files version field on new releases

GitHub Workflow Status GitHub release (latest by date) GitHub

๐Ÿง  Why

  • Most actions related to version upgrade do it backwards: when you push a commit with version change in a specific branch a release is created.

  • This action does the opposite: when you create a release the specified files will get updated with the new version, so you don't forget to update them.

This comes in handy when working with git workflows such as trunk-base-development or master-only.

๐Ÿš€ Usage

With the following example after creating a new release with tag v2.0.1 on branch release, a new commit will appear in that same branch with both package.json and app.yaml updated with the version field to 2.0.1.

name: Upgrade Version
on:
  release:
    types: [published]

jobs:
  upgrade-version:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: pocket-studios/action-update-version@v1
        with:
          files: 'package.json, app.yaml'
          version-regexp: '\d+.\d+.\d+'
          repo-token: ${{ secrets.GITHUB_TOKEN }}

The action will fail if:

  • Both repo-token and branch-name are not supplied

  • The tag cannot be found by octokit

  • The regular expression cannot match the release tag

  • You specify a file with unsupported extension

  • Supported file extensions: json, yaml and yml. To add one simply submit a PR with a new parser on the main.ts file.

โš™ Inputs

By supplying the repo-token the commit will use the release information: author and branch.

You can change the branch commit target and the commit author if you want.

Name Description Default
files Comma separated list of files to update its version field package.json
version-regexp Regular expression to match release tag name \d+.\d+.\d+
repo-token GitHub token to get the release information in order to push to branch null
commit-message Commit message for files update. The %version% will get substituted ci: update version to v%version%
spacing-level Number of spaces for formatted files 2
branch-name Default branch name to push changes if not repo-token is provided Release target branch
author-name Commit author name Release author name
author-email Commit author email Release author email

๐Ÿ‘‹ Support

If you find our work useful, you can support our work and win a burrito ๐ŸŒฏ

action-update-version's People

Contributors

renovate[bot] avatar jczacharia avatar

Watchers

James Cloos 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.