Skip to content
at-sign

GitHub Action

Export Version

v1.1.0 Latest version

Export Version

at-sign

Export Version

Extract package version from package.json and export it

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Export Version

uses: wow-actions/[email protected]

Learn more about this action in wow-actions/export-version

Choose a version

๐ŸŽ— 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