-
Notifications
You must be signed in to change notification settings - Fork 1
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
Auto update gh-pages branch when docs are updated. #44
Conversation
Travis needs to be enabled for the project and an API key needs to be added in the travis console. |
deploy.sh
Outdated
exit 0 | ||
fi | ||
|
||
git clone --quiet --branch=gh-pages https://oliverroick:[email protected]/cadasta/api-docs /home/travis/build/cadasta/docs-branch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@oliverroick
You need to generate an API key and use it in travis.
- Read about generating an API key here.
- Once you generate the API key open the project in travis-ci.org.
- In settings tab add an environment variable. Name the variable
API_KEY
and value the key you generated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll create a bot user for these tasks, that build won't break when a user is removed from the team.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @m-murad, thanks for getting automated deploys started. That will make the process much easier for us.
I left a few comments that I would like you to address. Once we have accepted your changes, I'll enable the project on Travis so we can see if the project is built correctly.
deploy.sh
Outdated
@@ -1,29 +1,26 @@ | |||
#!/bin/bash | |||
|
|||
rm -rf dddocs | |||
rm -rf docs-build | |||
if [ "$TRAVIS_PULL_REQUEST" != "false" -o "$TRAVIS_REPO_SLUG" != "cadasta/api-docs" ]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This condition looks wrong. The first part excludes all builds on pull requests, the second part excludes all builds that are not triggered from cadasta/api-docs
, which will never become false
, since all builds will always be triggered from cadasta/api-docs
.
Connecting both with an OR
operator (you're using -o
) means the build will never exit.
As I suggested in my comment to the corresponding issue, I would use:
if ["$TRAVIS_TAG" != "false"]
That way we only ever deploy when a new version has been tagged.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"$TRAVIS_REPO_SLUG" != "cadasta/api-docs"
This condition is for a scenario where commit or PR is made on the forked copy of this repository.
e.g. if I'm making the changes on my own copy of the repository i.e. m-murad/api-docs
the auto update will be skipped.
deploy.sh
Outdated
exit 0 | ||
fi | ||
|
||
git clone --quiet --branch=gh-pages https://oliverroick:[email protected]/cadasta/api-docs /home/travis/build/cadasta/docs-branch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll create a bot user for these tasks, that build won't break when a user is removed from the team.
deploy.sh
Outdated
echo "Done." | ||
git add . | ||
git commit -m "Deploy docs" | ||
git push origin gh-pages --quiet |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the time being, can we push this to another branch, maybe gh-pages-test
? I want to see the script in action before we start overwriting docs website.
Once your changes are approved, I'll change that back.
deploy.sh
Outdated
mkdir docs-build | ||
npm install |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not too familiar with building Node projects on Travis. I'm assuming that Travis always runs npm install
by default?!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes it does. You can check it here.
deploy.sh
Outdated
rm -rf docs-build | ||
echo "Done." | ||
git add . | ||
git commit -m "Deploy docs" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a way to use the content of $TRAVIS_TAG
here to get nicer commit messages? For example, if we tag 1.0.1
that we end up with the commit message Deploy docs v1.0.1
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm still not able to understand what you are trying to say.
I checked this repository but no tag has been created for this repository. Maybe if you can explain it to me.
What we can do we can use the commit message of the commit that is being build or the branch of the pull request.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, no tags have been created so far. But we will create tags in the future to kick off the deployment process.
So whenever we think that what is on master
is ready, we create a new tag, which deploys the docs. I don't want to deploy the docs with every push to master for a simple reason: When we build features for the API and document the changes, the changes to the documentation might be merged to master before the changes to the API are released. If we deploy with every push to master, the documentation won't match the current API and we can avoid that by tagging versions on master and deploy only when a new tag is created.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For that we can do something else.
Once a TAG is created at cadasta/cadasta-platform
i will right a script that will create the TAG in this repository as well.
This way the docs will remain updated after every commit and when a new tag is created for cadasta-platform
it will automatically create a tag for api-docs
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Creating a TAG at cadasta/cadasta-platform
and cadasta/api-docs
at same time will makes sense. That way we can also corrosponde every version of cadasta-platform to its doc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm suggesting updating the docs after every commit because after my PRs #37, #39, #36
The docs are still not updated to reflect the changes.
We simply forgot; I'll take care of the deployment tomorrow. Updating the docs after every commit is still not an option.
Once a TAG is created at cadasta/cadasta-platform i will right a script that will create the TAG in this repository as well.
That's something we can do further down the line. I'd say we focus on this PR first and then look at follow-ups.
@oliverroick |
Yes that's correct |
@oliverroick The commit message will be of the format |
I have fixed this. Please review
…On Oct 30, 2017 1:07 PM, "Oliver Roick" ***@***.***> wrote:
Yes that's correct
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#44 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AQdmZNimzn6M4_VIDRaiJ_EaC_4bm2dTks5sxXyggaJpZM4P_-5Z>
.
|
It's on my list. I'll review when I get to it. It's not the highest priority at the moment |
This PR is relate to #40
This will auto update
gh-pages
branch whenmaster
branch is updated.@oliverroick please review.