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

Publish only when the tags are pushed #117

Closed
pritibiyani opened this issue Apr 26, 2019 · 5 comments
Closed

Publish only when the tags are pushed #117

pritibiyani opened this issue Apr 26, 2019 · 5 comments

Comments

@pritibiyani
Copy link

  • Does GO/CD has a support to get triggered on tags push?
  • We want to publish an npm package only when a tag is pushed and not every time. We can make it manual trigger, but trying to automate.

Something like follow:

// .travis.yml
language: node_js
node_js:
- '8'
deploy:
  provider: npm
  email: dungnq@itbox4vn.com
  api_key:
    secure: BSjy5UrLZOgrTnaA...
  on:
    branch: master
    **tags: true**

Let me know if there is any other way to approach this one.

Thanks.

@tomzo
Copy link
Owner

tomzo commented Apr 26, 2019

The default git material does not see tags as a change. To make it work exactly as you said, you could write your own material plugin.
However consider that GoCD could be tagging and pushing the git tag as part of a manual trigger pipeline/stage after which next stage would publish the npm package. I presume that tag is currently pushed by a developer, so it is a manual step anyway. The difference would be that developer has to click on the GoCD UI to approve the release stage.

@arvindsv
Copy link
Contributor

I'd consider something like this:

[[ -n "$(git tag --points-at HEAD)" ]] && echo "New tag."

The echo will only get called if the HEAD commit points to a tag. Of course, there are corner cases, where it won't work if you push multiple tags or you do something like:

git commit -m "Tag commit here"
git tag v1
git commit -m "Non-tag commit here"
git push

Then, HEAD won't point to a tag. It's solvable, of course, using the from and to revision environment variables that GoCD provides.

@pritibiyani
Copy link
Author

pritibiyani commented Apr 29, 2019

@tomzo

The git tag push is a manual process and that is a trigger to publish the package. And with the push of that, I want to perform 2 tasks and that's where I want to avoid manual trigger.

@arvindsv

Can you point me out to more concrete example if there is any. Thanks. :)

@yacinelazaar
Copy link

@pritibiyani
Hey, did you figure this out.
Kinda need the same thing...desperately

@pritibiyani
Copy link
Author

@yacinelazaar

We changed approach over here and decided not to deploy with tags.

@tomzo tomzo closed this as completed Sep 13, 2020
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

4 participants