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 ispre
,the date is2022-04-25
(April 25th, 2022 UTC), and thesha
commit (first 8 characters) isabcde123
the pre-release version will be1.2.3-pre.2022-04-25.sha-abcde123
- for example if your current version is
- 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
See action.yml
Basic:
steps:
- name: Update your package.json with an npm pre-release version
id: pre-release-version
uses: adobe/update-prerelease-npm-version@v1.0.0
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
- Don't forget to run
npm run package
to generate package your new code for use, before publishing.
Contributions are welcomed! Read the Contributing Guide for more information.
This project is licensed under the Apache V2 License. See LICENSE for more information.