Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use semantic-release to publish to npm #19

Open
4 tasks done
tkyi opened this issue Mar 26, 2020 · 5 comments
Open
4 tasks done

Use semantic-release to publish to npm #19

tkyi opened this issue Mar 26, 2020 · 5 comments
Assignees

Comments

@tkyi
Copy link
Contributor

tkyi commented Mar 26, 2020

Issue

The package was last published 3 years ago manually. Would like to publish new versions.

Request

It would be nice to set up the Screwdriver pipeline so it can publish using semantic release.

Steps

  • Add publish job in screwdriver.yaml
  • Add semantic-release script and release config in package.json
  • Add GH_TOKEN and NPM_TOKEN to Screwdriver secrets
  • Add sd-buildbot as a collaborator with write permissions
@tkyi tkyi self-assigned this Mar 26, 2020
@tkyi
Copy link
Contributor Author

tkyi commented Mar 26, 2020

Seeing these errors since the last published version's commit is missing in the Git history:

00:00:25 $ ./node_modules/.bin/semantic-release pre && npm publish && ./node_modules/.bin/semantic-release post
00:00:26 semantic-release ERR! commits The commit the last release of this package was derived from is not in the direct history of the "master" branch.
00:00:26 semantic-release ERR! commits This means semantic-release can not extract the commits between now and then.
00:00:26 semantic-release ERR! commits This is usually caused by force pushing, releasing from an unrelated branch, or using an already existing package name.
00:00:26 semantic-release ERR! commits You can recover from this error by publishing manually or restoring the commit "40b02ddbca262a484f6d47a43fac704e9c7c49d0".
00:00:26 semantic-release ERR! pre Failed to determine new version.
00:00:26 semantic-release ERR! pre ENOTINHISTORY Commit not in history

@tkyi
Copy link
Contributor Author

tkyi commented Mar 26, 2020

Ref: semantic-release/semantic-release#132 (comment)
Ended up publishing to npm manually and pushing the latest tags manually:

  1. Set the version
npm version 2.4.0 
  1. Published to npm
npm publish --tag latest
  1. Pushed the tag to git
git push origin --tags

@tkyi
Copy link
Contributor Author

tkyi commented Apr 1, 2020

Still getting a similar error message but with a different commit sha.

00:00:25 $ ./node_modules/.bin/semantic-release pre && npm publish && ./node_modules/.bin/semantic-release post
00:00:26 semantic-release ERR! commits The commit the last release of this package was derived from is not in the direct history of the "master" branch.
00:00:26 semantic-release ERR! commits This means semantic-release can not extract the commits between now and then.
00:00:26 semantic-release ERR! commits This is usually caused by force pushing, releasing from an unrelated branch, or using an already existing package name.
00:00:26 semantic-release ERR! commits You can recover from this error by publishing manually or restoring the commit "b219c513aa7e9826e30260371bb582815ed1eb3b".
00:00:26 semantic-release ERR! pre Failed to determine new version.
00:00:26 semantic-release ERR! pre ENOTINHISTORY Commit not in history

@tkyi
Copy link
Contributor Author

tkyi commented Apr 21, 2020

Ran these commands to publish new major version:

  1. Manually publish new version to npm
npm --no-git-tag-version version 3.0.0
  1. Make sure local tag doesn't already exist
git tag -d v3.0.0
git tag -a v3.0.0 -m "Only support node10 and up"
  1. Push new tag
git push --tags -f

Helpful commands:

  • Check local git tags
git ls-remote --tags
  • Check local git logs for version tags, etc
git log

@brettz9
Copy link
Contributor

brettz9 commented Apr 25, 2020

Looks like this is working? 🎉 Can the issue be closed if so?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants