Skip to content

Commit 8ccdf8a

Browse files
committed
Add support for publishing a package that isn't at repo root
1 parent c05919e commit 8ccdf8a

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
@@ -20,3 +20,15 @@ you'll need to configure that workflow yourself. You can look to the
2020
* All other changes will increment the patch version.
2121
* Publish to npm using the configured token.
2222
* Push a tag for the new version to GitHub.
23+
24+
### Additional Configuration
25+
26+
* 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
27+
```
28+
- name: Publish
29+
uses: mikeal/merge-release@master
30+
env:
31+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32+
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
33+
PACKAGE_PATH: ./packages/my-package
34+
```

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', process.env.NPM_REGISTRY_URL || 'https://registry.npmjs
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)