Git Product home page Git Product logo

update-prerelease-npm-version's Introduction

update-prerelease-npm-version

A Github Action to update your node module version with a prerelease version.

This action provides the following functionality for GitHub Actions users:

  • generates a pre-release version string with a tag, the current date in YYYY-MM-DD, and the sha hash of the latest commit
    • for example if your current version is 1.2.3, the pre-release tag is pre,the date is 2022-04-25 (April 25th, 2022 UTC), and the sha commit (first 8 characters) is abcde123 the pre-release version will be 1.2.3-pre.2022-04-25.sha-abcde123
  • modifies your package.json version property with this generated pre-release version string
  • adds a prereleaseSha property to your package.json. This contains the latest SHA commit of the repo prior to publishing
  • outputs the generated pre-release version string into the pre-release-version output variable

Usage

See action.yml

Basic:

steps:
- name: Update your package.json with an npm pre-release version
  id: pre-release-version
  uses: adobe/[email protected]
  with:
    # if not specified, use the default "pre" (optional)
    pre-release-tag: 'mytag' 
    # if not specified, use the default "package.json" (optional)
    package-json-path: 'some/path/package.json'
    # if specified, it will find the dependencies in package.json and update with the dependencies-to-update-version-tag
    dependencies-to-update: semver,to-camel-case
    # the version tag to update the dependencies-to-update list with
    dependencies-to-update-version-tag: next
    # the package name to publish to (optional)
    package-name: @adobe/my-cli-next
    # boolean whether to skip dependencies-to-update (optional)
    skip-dependencies-to-update: false

# your package.json version should be transformed after the previous step
- run: cat package.json
# access the pre-release version output. output variable is "pre-release-version"
- run: echo ${{ steps.pre-release-version.outputs.pre-release-version }} 
# then you publish your package with this pre-release version, under a tag (say 'next' here)
- run: npm publish --tag next

Development

  • Don't forget to run npm run package to generate package your new code for use, before publishing.

Contributing

Contributions are welcomed! Read the Contributing Guide for more information.

Licensing

This project is licensed under the Apache V2 License. See LICENSE for more information.

update-prerelease-npm-version's People

Contributors

dependabot[bot] avatar michaelgoberling avatar shazron avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

ghas-results

update-prerelease-npm-version's Issues

Replace bin

I ended up doing this another way, but it might be good to support changing the exported 'bin' for prereleases.
Something like this ...

In utils ...

function setPackageBin (packageBinName, packageJson) {
  if (packageBinName && packageBinName.trim().length > 0) {
    const [key, value] = Object.entries(packageJson.bin)[0]
    packageJson.bin = { [packageBinName] : value }
  }
  return packageJson
}

In index ...

const packageBinName = core.getInput('package-bin')
if (packageBinName && packageBinName.trim().length > 0) {
  setPackageBin(packageBinName, packageJson)
}

There are some interesting edge cases not covered by this, like supporting multiple bins.
if you think this has a place here, let me know and I will open a pr

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.