Skip to content

Conversation

davidecavestro
Copy link

The mvn deploy goal is automatically triggered by travis after a successful build on branch master.

It uses the snapshot_settings.xml file in order to get username and password from env variables, respectively CI_DEPLOY_USERNAME and CI_DEPLOY_PASSWORD.
The env variables can be configured into the travis profile UI from |Settings|Env variables|. By default they are masked/encrypted.

Please note:

  1. I've supposed you want to auto publish snapshots only for master: this can be refined tweaking the test of git branch variable set by travis
  2. so far I've only been able to test the fact that changing the relevant env variables in my travis profile produces effects in my attempts to publish on the official snapshots repo. Since my credentials are wrong my deploy obviously fails. So far I've not found a maven repo easily accessible from Travis for which I have valid credentials, so my tests are limited to failures :-)

This patch is based on https://coderwall.com/p/9b_lfq/deploying-maven-artifacts-from-travis

@d-michail
Copy link
Member

Thanks!

Could you move the "snapshot_settings.xml" to the etc/ folder?

One question. Do we need to encrypt the environmental variables as

travis encrypt -r you/yourrepo "CI_DEPLOY_USERNAME=username"
travis encrypt -r you/yourrepo "CI_DEPLOY_PASSWORD=password"

by hand before storing them into the travis profile?

@davidecavestro
Copy link
Author

davidecavestro commented Feb 1, 2018

I've moved the settings into the etc folder.
I expect setting the passwords (hidden) from UI is alternative to encrypting manually as you showed and putting the value into the .travis.yml file, as per https://docs.travis-ci.com/user/environment-variables/#Defining-Variables-in-Repository-Settings

By default, the value of these new environment variables is hidden from the export line in the logs. This corresponds to the behavior of encrypted variables in your .travis.yml. The variables are stored encrypted in our systems, and get decrypted when the build script is generated.
Similarly, we do not provide these values to untrusted builds, triggered by pull requests from another repository.

Please also note the feature depicted into the last sentence could be of some interest.

@jsichi
Copy link
Member

jsichi commented Feb 2, 2018

Cool, I'll give it a try with the project credentials.

@jsichi jsichi merged commit 9ee396d into jgrapht:master Feb 3, 2018
@jsichi
Copy link
Member

jsichi commented Feb 3, 2018

I merged this and then set the credentials and then forced a rebuild, and looks like it published correctly, w00t. Thanks a million!

@davidecavestro
Copy link
Author

davidecavestro commented Feb 3, 2018 via email

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

Successfully merging this pull request may close these issues.

3 participants