npm version, git push and npm publish
This discussion is public.
I have an npm assets project that doesn't require a build. I'm attempting to have the master branch auto update the version via npm, commit that back to GitHub and also publish to npm.
I've gone through a dozen iterations of the script below.
When I hard code the npm version %version% to a specific number that works, but without it, it does not change the version and the npm push fails due to "not being able to overwrite previous versions" (https://ci.appveyor.com/project/geobmx540/twoeightycap-web-library-...)
I don't understand why "Echo is off" or how to turn that on. (doesn't really matter except when I try to print out the version variable)
Git push doesn't work - " git push origin HEAD:"
https://ci.appveyor.com/project/geobmx540/twoeightycap-web-library-...
version: 1.0.{build}
environment:
access_token:
secure: ...
build: off
skip_commits:
message: /^v(\.?[0-9]+)+$/g # Regex for matching version commit messages
branches:
only:
- master
on_finish:
- git config --global credential.helper store
- ps: Add-Content "$env:USERPROFILE\.git-credentials" "https://$($env:access_token):x-oauth-basic@github.com`n"
- cmd: echo %version%
- git push
- npm version %version% -m 'v%version%'
- npm publish
Comments are currently closed for this discussion. You can start a new one.
1
Ilya Finkelshteyn
on 10 Oct, 2016 04:42 PM
Hello,
I am not sure I understand where value of
%version%
variable should come from? I do not see it is being set anywhere in your YAML configuration and also it is not any of standard or Appveyor build worker environment variables.ECHO is off
returned because%version%
is empty. Did you intend you use%APPVEYOR_BUILD_VERSION%
?--ilya.
2
geobmx540
on 10 Oct, 2016 07:32 PM
Hey ilya -
I've seen %version% all over the place and I thought it was set on the first line. I gave it a shot and that worked, also you're right on the ECHO issue.
The git issue was a non-issue..
Thanks, silly issue on my end.
3
Ilya Finkelshteyn
on 10 Oct, 2016 07:51 PM
That's all good, thanks for letting us know :)
Ilya Finkelshteyn closed this discussion on 25 Aug, 2018 02:09 AM.