GitXplorerGitXplorer
K

set-node-package-version

public
1 stars
2 forks
1 issues

Commits

List of commits on branch main.
Unverified
adfd53d7e4362eba8544fff6163966426c99f3cb

file: add dist/index.js

KKageKirin committed 3 years ago
Unverified
06874cca52e7807f7dc104c3b295e8f35f6b1187

ci: add publish workflow

KKageKirin committed 3 years ago
Unverified
9092aefdd9e30e2d3d9408ef79c6f7bf7ab6b574

ci: add test workflow

KKageKirin committed 3 years ago
Unverified
e9d9f648a17c906a812a1c6c7cbc40250740b45a

file: add testdata

KKageKirin committed 3 years ago
Unverified
68ded5f775bc6d5a44b9960b8e63011c8a51a14c

file: add index.js

KKageKirin committed 3 years ago
Unverified
6d27432ba9f5d7c86ff0e24841f05ab0845823a9

file: add action.yml

KKageKirin committed 3 years ago

README

The README file for this repository.

set-node-package-version

GitHub Action to set the current version to a package.json. Places the set version into a context variable for later reference.

Usage

In a GitHub Workflow that runs after pushing a tag:

name: Auto-version on tag

on:
  push:
    tags:
      - '*'

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2

      - name: Set version
        id: package_version
        uses: KageKirin/set-node-package-version@v0
        with:
          version: ${{ github.ref_name }}

      - name: Commit new version
        run: |
          git commit -am "CI: update version from tag"
          git push https://${{ github.token }}@github.com/OWNER/REPO

Inputs

file

This represents the path to the package.json to set the version number to. It defaults to package.json, but you might need to adapt it if the file is named differently, or lies in a subfolder.

regex

This is the Regular Expression used to verify the version. It defaults to an equivalent of major.minor.patch and requires all 3 integers to be present.

version (input)

This is the version string to write into the package. It must match the provided regex format.

Outputs

version

This the version string as retrieved from the package.json after writing to the file.

Errors

The action will fail if:

  • it can't open the file
  • it fails to retrieve the version element
  • the version string does not match the provided regex