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

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

Publish only when the tags are pushed #117

pritibiyani opened this issue Apr 26, 2019 · 5 comments

Comments

@pritibiyani
Copy link

@pritibiyani pritibiyani commented Apr 26, 2019

  • 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

This comment has been minimized.

Copy link
Owner

@tomzo 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

This comment has been minimized.

Copy link
Contributor

@arvindsv arvindsv commented Apr 26, 2019

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

This comment has been minimized.

Copy link
Author

@pritibiyani 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

This comment has been minimized.

Copy link

@yacinelazaar yacinelazaar commented Dec 24, 2019

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

@pritibiyani

This comment has been minimized.

Copy link
Author

@pritibiyani pritibiyani commented Jan 3, 2020

@yacinelazaar

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.