Skip to content

Commit a352c06

Browse files
authored
Merge pull request #4 from jsm174/feature/path-input
path: added support for specifying package.json path
2 parents 9c1af91 + 55012ae commit a352c06

File tree

7 files changed

+1478
-978
lines changed

7 files changed

+1478
-978
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ You should use this action in a workflow immediately after checkout. The followi
3434

3535
For inputs, the following options are available:
3636

37+
- `path` - path to folder containing package.json (leave blank for root folder).
3738
- `tagPrefix` - adds a string to the `nextTag` (default: '').
3839

3940
Example yml:
@@ -44,7 +45,7 @@ Example yml:
4445
fetch-depth: 0
4546
- name: Fetch next version
4647
id: nextVersion
47-
uses: VisualPinball/[email protected].6
48+
uses: VisualPinball/[email protected].7
4849
with:
4950
tagPrefix: 'v'
5051
- name: Log next version outputs

action.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ name: 'VisualPinball.NextReleaseAction'
22
description: 'Action used for determining the next version of VisualPinball.* projects.'
33
author: 'Jason Millard <[email protected]>'
44
inputs:
5+
path:
6+
required: false
7+
description: 'Path to folder containing package.json'
58
tagPrefix:
69
required: false
710
description: 'Prefix when tagging the release'

dist/index.js

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

Lines changed: 1466 additions & 973 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "next-version-action",
3-
"version": "0.1.6",
3+
"version": "0.1.7",
44
"description": "Action used for determining the next version of VisualPinball.* projects.",
55
"main": "lib/main.js",
66
"scripts": {

src/main.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,9 @@ function isBump(v1: SemVer, v2: SemVer): boolean {
6969

7070
async function run(): Promise<void> {
7171
try {
72-
const version = JSON.parse(readFileSync('package.json', 'utf8')).version;
72+
const path = core.getInput('path') || '.';
73+
74+
const version = JSON.parse(readFileSync(`${path}/package.json`, 'utf8')).version;
7375
core.setOutput('version', version);
7476
console.log(`version: ${version}`);
7577

0 commit comments

Comments
 (0)