Skip to content

Commit adbf93b

Browse files
committed
Add support for publishing a package that isn't at repo root
1 parent fbfd53a commit adbf93b

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,15 @@ you'll need to configured that workflow yourself. You can look to the
88

99
### Workflow
1010

11+
* Set `PACKAGE_PATH` env variable if `package.json` is not in repo root directory
12+
```
13+
- name: Publish
14+
uses: mikeal/merge-release@master
15+
env:
16+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
17+
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
18+
PACKAGE_PATH: ./packages/my-package
19+
```
1120
* Check for the latest version number published to npm.
1221
* Lookup all commits between the git commit that triggered the action and the latest publish.
1322
* If the package hasn't been published or the prior publish does not include a git hash, we'll

merge-release-run.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const get = bent('json', 'https://registry.npmjs.org/')
1212

1313
const event = JSON.parse(fs.readFileSync('/github/workflow/event.json').toString())
1414

15-
let pkg = require(path.join(process.cwd(), 'package.json'))
15+
let pkg = require(path.join(process.env.PACKAGE_PATH || process.cwd(), 'package.json'))
1616

1717
const run = async () => {
1818
if (!process.env.NPM_AUTH_TOKEN) throw new Error('Merge-release requires NPM_AUTH_TOKEN')

0 commit comments

Comments
 (0)