Skip to content

Extract package version from package.json and export it

License

Notifications You must be signed in to change notification settings

wow-actions/export-version

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

🎗 Export Version

build MIT License Language PRs Welcome website

Extract package version from package.json and export it

🚀 Usage

Create a .github/workflows/export-version.yml file in the repository you want to install this action, then add the following to it:

name: Export Version
on:
  push:
    branches:
      - master
jobs:
  run:
    runs-on: ubuntu-latest
    steps:
      - uses: wow-actions/export-version@v1
        with:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

The default config will generate a file "src/version.ts" with the following content:

/* eslint-disable */

/**
 * Auto generated version file, do not modify it!
 */
const version = 'xxx'
export { version }

Inputs

Various inputs are defined to let you configure the action:

Note: Workflow command and parameter names are not case-sensitive.

Name Description Default
GITHUB_TOKEN The GitHub token for authentication N/A
source The package.json path or the directory path contains a package.json file 'package.json'
target The auto generated target file path 'src/version.ts'
template Template to render the target file content
Placeholder {{version}} is supportted
...
commitMessage Commit message to create/update the target file 'chore: update version file [skip ci]'

🔖 License

The scripts and documentation in this project are released under the MIT License

About

Extract package version from package.json and export it

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Contributors 3

  •  
  •  
  •