github
github copied to clipboard
publish `dist` directory as `Source code (zip)` asset instead of root
My project's build outputs assets to a dist directory. This is what I publish to NPM and it's what I'd like to publish to github.
Here's my config:
module.exports = {
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/changelog",
["@semantic-release/npm", {
"pkgRoot": "dist",
}],
"@semantic-release/github",
"@semantic-release/git"
],
"preset": "angular"
}
This works (mostly). The package is published to NPM and Github but the package that's published to Github as Source code (zip|tar.gz) is the project root, not the dist directory.
Here's an example: https://github.com/gpspake/npm-demo-shared-dependency/releases/tag/v1.1.4
@semantic-release/npm has a pkgRoot option that can be used to specify which directory to publish
["@semantic-release/npm", {
"pkgRoot": "dist",
}],
I figured the assets option would work the same way so tried setting it to dist and dist/** but that just publishes the flat files (in addition to the compressed source from the root directory)
["@semantic-release/github", {
"assets": "dist/**"
}],
Is there a "pkgRoot" equivalent for @semantic-release/github or an implicit way to specify that?
Or am I missing some obvious reason I wouldn't need it? 🙂
Here are a couple of SO threads about this: https://stackoverflow.com/q/69841763/1827642 https://stackoverflow.com/q/69872861/1827642
In my case, I'd like to supress generation of the source zip and tarball entirely. That's what my git tags are for. But per this comment, they're apparently added by github not semantic-release and cannot be disabled: https://github.com/semantic-release/semantic-release/issues/1597#issuecomment-656370768
github uses git export though, so you can use .gitattributes to suppress exporting. See https://stackoverflow.com/a/58443948/398670
@gpspake Looks like you can't do it; it's autogenerated by github.