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

Deploy gh-pages branch from travis #45

Merged
merged 25 commits into from
Jan 14, 2015
Merged

Deploy gh-pages branch from travis #45

merged 25 commits into from
Jan 14, 2015

Conversation

mnapoli
Copy link
Member

@mnapoli mnapoli commented Nov 29, 2014

WIP for #34

(this is #44 but merged into a local branch so that we can all push commits to it and we can test the results in this repository)

To safely deploy with Couscous from a Travis build we need to take this things into consideration:

  • Make sure the deployment is running only for master.
  • Make sure it is not a pull request.
  • Make sure we deploy once per build. E.G. don't deploy for every PHP version tested 😄
  • Decide what to use to deploy: Private Key or Personal Access Token
  • Write documentation in docs/travis.md
  • Couscous specific problem: don't generate & upload couscous.phar for pushes to master (else we might push an unstable phar) (will be done in a new PR)

The process is detailed in docs/travis.md

Feel free to add commits and keep working on this together.

@mnapoli
Copy link
Member Author

mnapoli commented Nov 29, 2014

As I said in Gitter, I've copy-pasted your instructions in doc/travis.md: that documentation article needs to be linked into doc/README.md.

@mnapoli
Copy link
Member Author

mnapoli commented Nov 30, 2014

I think with the latest commit it will be easier: no custom deploy, it uses couscous deploy.

In the future I wish we could get rid of the deploy.sh script. Maybe have a new command (couscous autodeploy-travis) that would do what deploy.sh does today.

@lombartec
Copy link
Member

@mnapoli Looks better now, I felt so bad for not using couscous deploy 😋

@nicosomb
Copy link

nicosomb commented Dec 9, 2014

I can help to try travis deployment. It's the main feature to make me switch from daux.io.


if ($travisBranch != 'master') {
$output->writeln('<notice>[NOT DEPLOYED] Deploying Couscous only for master branch</notice>');
exit(1);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the command return 0 instead (here and below in the class)? Anything not 0 is interpreted as an error, so I'm afraid it might fail Travis build.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mmh weird, exit(1) didn't fail the build (https://travis-ci.org/CouscousPHP/Couscous/jobs/43091310) I'm missing something here

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mnapoli it is because this is being executed in the after_success section (which is right).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK! But even then should we not return 0 deployed or not (except if an actual error occurs of course).

@mnapoli
Copy link
Member Author

mnapoli commented Dec 9, 2014

@nicosomb cool! I just see that @wysow added some commits, so I guess you can require-dev this branch and try it in your repo.

@wysow wysow force-pushed the travis branch 2 times, most recently from c25a0ec to 9b222d3 Compare December 19, 2014 12:15
@nicosomb
Copy link

All is almost fine https://github.com/wallabag/documentation

Just one problem with this part of code

        $isPullRequest = (bool) getenv('TRAVIS_PULL_REQUEST');

        if ($isPullRequest) {
            $output->writeln('<notice>[NOT DEPLOYED] Not deploying Couscous for pull requests</notice>');
            exit(1);
        }

TRAVIS_PULL_REQUEST is TRUE, even it's a commit, not a PR.
@wysow is working on it ;-)

@nicosomb
Copy link

I finally managed to build website thanks to Jenkins https://travis-ci.org/wallabag/documentation/builds/44868579
And the website is there: http://wallabag.github.io/documentation/

@wysow
Copy link
Member

wysow commented Dec 27, 2014

@CouscousPHP/collaborators This PR is ready for review at last... ;)

Comments welcome and tell me if I need to squash...

@mnapoli
Copy link
Member Author

mnapoli commented Dec 27, 2014

@wysow awesome!

But just thought of something: if we generate the website for master, then it will re-generate and upload couscous.phar every time too. Which means the phar that people download is not the latest stable: instead it's based on master. I think it's a problem…

Maybe we could imagine another workflow to generate/upload couscous.phar? I don't see a problem with having the documentation up to date with master though, the problem is only with the phar.

@mnapoli
Copy link
Member Author

mnapoli commented Dec 27, 2014

Or we could add (yet another) option to travis-auto-deploy to say "deploy only for tags". That way when we tag a new version, the travis build will generate the phar and update the website. But at the same time I like having the doc up to date with master…

@mnapoli mnapoli added this to the 1.1 milestone Dec 27, 2014
@mnapoli
Copy link
Member Author

mnapoli commented Dec 27, 2014

For the record I've updated the documentation, feel free to review & improve it.

/**
* @var Filesystem
*/
private $filesystem;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems this property is not used, could be removed.

@lombartec
Copy link
Member

@wysow I had a bit of time today to apply some stuff @mnapoli commented out. I left some things todo as I could not test them.

@nicosomb
Copy link

But at the same time I like having the doc up to date with master…

And I like it too.

@mnapoli
Copy link
Member Author

mnapoli commented Dec 29, 2014

@nicosomb we discussed that topic a bit on gitter and the solution we imagined would be:

  • website always regenerated with master
  • separate the release process (tagging + generating the phar) from website update

So we would remove these lines from couscous.yml.

Things that would be required though:

  • Couscous empties the website dir before generating, so couscous.phar would be deleted from the website upon regeneration: we need to avoid that (maybe a new option in couscous.yml to define files to preserve)
  • we would need a release script (maybe not needed in this PR so that we don't hold it eternally):
    • could be a Travis deploy job that is triggered when we do a GitHub release (http://docs.travis-ci.com/user/deployment/releases/)
    • the Travis job/script would generate the phar in before_deploy
    • it would then upload the phar on the GitHub release (Travis deploy config)
    • it would also update the phar on the gh-pages branch with after_deploy (a bit of work…)

mnapoli and others added 24 commits January 14, 2015 09:49
@wysow
Copy link
Member

wysow commented Jan 14, 2015

@CouscousPHP/collaborators Feel free to review and merge if it's ok for you guys! ;)

@mnapoli
Copy link
Member Author

mnapoli commented Jan 14, 2015

Let's ship it!

 .  o ..                  
 o . o o.o                
      ...oo               
        __[]__            
     __|_o_o_o\__         
     \""""""""""/         
      \. ..  . /          
 ^^^^^^^^^^^^^^^^^^^^

mnapoli added a commit that referenced this pull request Jan 14, 2015
Deploy gh-pages branch from travis
@mnapoli mnapoli merged commit aa0ec90 into master Jan 14, 2015
@mnapoli mnapoli deleted the travis branch January 14, 2015 10:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants