GithubHelp home page GithubHelp logo

erlete / version-updater Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 406 KB

Package metadata version updater action executed on release publication.

Home Page: https://github.com/marketplace/actions/version-updater

License: GNU Affero General Public License v3.0

JavaScript 100.00%
package-json release release-automation update-version updater version-update versioning

version-updater's Introduction

Version Updater Action

If you can relate with the following steps, then this action is for you:

  1. Host the source code of your code in GitHub
  2. Update your code up to a stable version
  3. Release a new tag for the source code
  4. Realize that the version of the metadata file does not match the tag
  5. Update the version of the metadata file
  6. Create another tag for the source code
  7. Hope that you never forget to do this again
  8. Forget to do this once again

The Version Updater Action is designed to solve this problem.

Once a release is published, the action will update the version of a metadata file to match the version of the tag. This way, you can be sure that the version of the metadata file is always the same as the version of the tag.

But... does it work with any metadata file format? Yes! It has been programmed with that purpose in mind. The action can be configured to update any metadata file, not only package.json files. Check out the list of supported metadata files for more information.

Important notes

  • This action requires the repository to be checked out before being executed. This can be done by using the Actions Checkout action. This is intended to be fixed in the future.

  • The action can only be executed over release events of type published. This is due to the fact that the action needs to know the version of the tag to update the metadata file to.

  • The action is designed to be able to process version formats matching the vX.Y.Z format. If the version of the tag does not match this format, the action will most probably fail. Feel free to open an issue if you need support for other version formats.

Inputs

Input Description Required Default value
target-file The path to the metadata file to update Yes -
commit-title The title of the commit to create No "Update version to {version}"
commit-description The description of the commit to create No "The version of the package was updated to {version} based on the release triggered by @{author} in the {branch} branch."
git-name The name of the user to use when committing the changes No "GitHub Actions"
git-email The email of the user to use when committing the changes No "github-actions[bot]@users.noreply.github.com"

Commit title and description

The commit title and description can be customized using the commit-title and commit-description inputs. These inputs support the following placeholders:

Placeholder Description
{author} Name of the user who triggered the release
{branch} Name of the branch where the release was triggered
{version} Tag of the release
{release_title} Title of the release
{release_description} Description of the release

The curly braces ({}) are required to use the placeholders. If an unlisted placeholder is used, the raw placeholder will be used instead.

Outputs

This action does not have any outputs, except for a smile in your face when it works.

Example usage

Minimal implementation

Example 1 (standard):

uses: erlete/[email protected]
with:
  target-file: "package.json"

Example 2 (customized):

uses: erlete/[email protected]
with:
  target-file: "package.json"
  commit-title: "Bump version"
  commit-description: "The version of the package was updated to {version}."
  git-name: "John Doe"
  git-email: "[email protected]"

Complete implementation

name: Update package version

on:
  release:
    types:
      - published

jobs:
  update-version:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v2

      - uses: erlete/[email protected]
        with:
          target-file: "package.json"

Supported metadata files

Even though any file format can hypothetically be supported, the action only supports the following metadata files (yet):

  • package.json (and package-lock.json)
  • pyproject.toml

New metadata file formats can be added in the future. Feel free to open an issue if you need support for a specific format.

version-updater's People

Contributors

actions-user avatar erlete avatar github-actions[bot] avatar

Watchers

 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.