v16.0.0-beta.18 & Git Plugin - Edge Case
See original GitHub issueI’m setting up a workflow as described here: https://github.com/semantic-release/semantic-release/blob/beta/docs/usage/workflow-configuration.md
I have two pre-release branches:
dev
test
test
was ahead of dev
with a few fix commits. In addition to those manual commits, as a result of using semantic-release/git
plugin, the latest commit in the test
branch was done by semantic-release-bot
and contained [skip ci]
text in commit message.
After merging test
to dev
the release process in dev
branch has failed. This happened because the tip of the dev
was ahead of the commit that Travis checked out. It was the git
plugin that failed. It failed because of the classic “you should pull first” git error. Travis ignored the latest commit done by semantic-release/git
plugin in test
branch. I presume it ignored it because of the [skip ci]
message.
This probably can be easily fixed by removing [skip ci]
from the commit message template in the semantic-release/git
plugin, and then using if
condition somewhere inside .travis.yml
.
I believe that the documentation of the git
plugin should mention that edge case somewhere. Or maybe even stop suggesting usage of [skip ci]
. Otherwise the plugin should pull … which I think might lead to other kind of problems.
Config
module.exports = {
branches: [
//
'+([1-9])?(.{+([1-9]),x}).x',
{ name: 'release' },
{ name: 'master', channel: 'dev', prerelease: true },
{ name: 'test', prerelease: true },
],
plugins: [
'@semantic-release/commit-analyzer',
'@semantic-release/release-notes-generator',
[
'@semantic-release/npm',
{
npmPublish: false,
tarballDir: './',
},
],
[
'@semantic-release/git',
{
assets: ['package.json'],
message:
'chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}',
},
],
[
'@semantic-release/github',
{
assets: [
{
path: ['package-*.tgz'],
label: 'Build',
},
],
},
],
],
};
Travis
language: node_js
cache:
yarn: true
directories:
- node_modules
node_js:
- '10'
branches:
except:
- /^v\d+\.\d+\.\d+$/
before_install:
- curl -o- -L https://yarnpkg.com/install.sh | bash
- export PATH="$HOME/.yarn/bin:$PATH"
jobs:
include:
- stage: test, build and deploy
script:
- yarn build
deploy:
- provider: script
script:
- yarn semantic-release
skip_cleanup: true
on:
branch:
- master
- dev
- test
Versions in package.json
:
...
"@semantic-release/git": "7.1.0-beta.3",
"semantic-release": "16.0.0-beta.18"
...
Steps
git checkout -b dev
git push origin
git checkout -b test
git commit -m 'fix: fixes this or that'
git push origin
- ⏲ wait for release from
test
branch git checkout dev
git merge origin/test
git push origin
- ❗ Latest push to
test
would fail to produce new release with error similar to:
error: failed to push some refs to XXX
hint: Updates were rejected because a pushed branch tip is behind its remote
hint: counterpart. Check out this branch and integrate the remote changes
hint: (e.g. 'git pull ...') before pushing again.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (2 by maintainers)
No because the last commit would be the merge commit. Travis care about
[skip ci]
only if it’s the head commit.🎉 This issue has been resolved in version 8.0.0 🎉
The release is available on:
Your semantic-release bot 📦🚀