Closed alebianco closed 5 years ago
// If `extends` is defined, load and merge each shareable config with `options`
For now, you're still able to define branch
opt as a part of step-specific plugin config:
// ...
publish: [
// ...
['@qiwi/semantic-release-gh-pages-plugin', {branch: 'gh-pages'}]
]
I need to take a closer look at the sem-rel config resolver.
thanks for the suggestion but even with that, it always publish to gh-pages
. I need to be able to publish to master
or to any other branch really
@pvdlg, could you help us with this issue?
Looks like context.options.publish
in its [{path: 'thisPlugin', decraredOpts}, ...]
does not contain branch
option, but respects other. I did a couple of experiments: #1, #2
The first proves that branch
option was omitted, the second shows that msg
option was passed as expected.
Config resolver:
export const resolveOptions = (pluginConfig: TAnyMap, context: TContext, path = PLUGIN_PATH, step?: string): TAnyMap => {
const { options } = context
const base = pluginConfig[path] || {}
const extra = step && options[step] && castArray(options[step])
.find(config => get(config, 'path') === path) || {}
return { ...base, ...extra }
}
export const resolveConfig = (pluginConfig: TAnyMap, context: TContext, path = PLUGIN_PATH, step?: string): IGhpagesPluginConfig => {
const { env } = context
const opts = resolveOptions(pluginConfig, context, path, step)
const token = getToken(env)
const repo = getRepo(context)
return {
src: opts.src || DEFAULT_SRC,
dst: opts.dst || DEFAULT_DST,
msg: opts.msg || DEFAULT_MSG,
branch: opts.branch || DEFAULT_BRANCH,
token,
repo
}
}
@alebianco , finally I got it:
"publish": [
"@semantic-release/npm",
"@semantic-release/github",
{
"path": "@qiwi/semantic-release-gh-pages-plugin",
"msg": "updated",
"branch": "docs"
}
]
I'm not 100% sure how but this workaround seems to work, thank you
@antongolub running into this right now, there might have been a regression? Or maybe something changed on semantic release side.
Either way I have tried a bunch of different valid configurations and it still always pushes to gh-pages
publish: [
// ...
['@qiwi/semantic-release-gh-pages-plugin', {branch: 'releaseBranch'}]
]
plugins: [
// ...
{path: '@qiwi/semantic-release-gh-pages-plugin', branch: 'releaseBranch'}]
]
Hey, @iamogbz,
What does debug print if enabled?
debug('pluginConfig= %j', pluginConfig)
Can't configure the branch where to publish the site content. This is needed in order to publish user or organisation pages.
The option is being stripped when resolving the configuration in attempt to ignore semantic-release's own branch value. Introduced by v1.1.1 because of #5
https://github.com/qiwi/semantic-release-gh-pages-plugin/blob/master/src/main/config.ts#L59
Probably the best course of action would be to change parameter name.