Skip to content

Commit 24351d2

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

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,15 @@ you'll need to configured that workflow yourself. You can look to the
2121
* Publish to npm using the configured token.
2222
* Push the bumped npm version in package.json back into the repo.
2323
* Push a tag for the new version to GitHub.
24+
25+
### Additional Configuration
26+
27+
* If your `package.json` is not in the repo's root directory, Set `PACKAGE_PATH` env variable if `package.json` is not in repo root directory
28+
```
29+
- name: Publish
30+
uses: mikeal/merge-release@master
31+
env:
32+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
33+
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
34+
PACKAGE_PATH: ./packages/my-package
35+
```

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)