cucumber / cucumber-eclipse

Eclipse plugin for Cucumber
MIT License
192 stars 149 forks source link

Migrate to gh-actions / deploy updatesite to different folders in gh-pages #436

Open laeubi opened 3 years ago

laeubi commented 3 years ago

We are currently using Travis CI, but the goal would be to migrate this to gtihub actions.

As part of this migration, the deployment should be changed so that different branches are deployed to different folders (instead of different gh-pages) so we can have a better user-experience.

The structure should be as follows:

where each branch is a different build.

laeubi commented 3 years ago

I have created a basic action now: https://github.com/cucumber/cucumber-eclipse/actions

I think the first steps would be:

laeubi commented 3 years ago

@mattwynne I have tried to setup multiple branches in https://github.com/cucumber/cucumber-eclipse/blob/main/.github/workflows/maven.yml is this the right way or should I place a maven.yml in each branch that should be build?

laeubi commented 3 years ago

@qvdk FYI, another action required would be to disable the travis-ci jobs for this, is this simply deleting the .travis.yml file?

qvdk commented 3 years ago

Yes I confirm

mattwynne commented 3 years ago

is this the right way or should I place a maven.yml in each branch that should be build?

As I understand it, if you have a workflow like this in your main branch, it will run the workflow if you push to any of the branches listed in the on.push.branches array.

laeubi commented 3 years ago

@mattwynne I have created:

  1. A folder for branch https://github.com/cucumber/cucumber-eclipse/tree/gh-pages/update-site/v1.x
  2. a Workflow for the 1.x branch: https://github.com/cucumber/cucumber-eclipse/blob/1.x/.github/workflows/maven.yml
  3. The workflow produces an update-site under cucumber.eclipse.p2updatesite/target/repository/ that should be placed in the gh-pages directory

can you give a hint how this is bet archived, given that only that folder must always be updated by the workflow?

I think manually it would be something like the following steps:

  1. git clone gh-pages
  2. git rm update-site/v1.x
  3. cp cucumber.eclipse.p2updatesite/target/repository/ update-site/v1.x
  4. git add update-site/v1.x
  5. git commit
  6. git push

but maybe there are smarter ways than doing everything step by step with shell commands?

mattwynne commented 3 years ago

@laeubi do you mean that, once the mvn -B command has run, there's a directory cucumber.eclipse.p2updatesite/target/repository/ that you want copied to the right folder in the gh-pages branch?

If so, we're on the right lines. I think you need an action something like this:

- run: |
    cp -R cucumber.eclipse.p2updatesite/target/repository/ {{ runner.temp }}/output
    git checkout gh-pages
    rm -rf update-site/{{ github.ref }}
    cp -R {{ runner.temp }}/output update-site/{{ github.ref }}
    git add --update .
    git config --global user.email "github-actions@example.com"
    git config --global user.name "GitHub Actions"
    git commit -m "Add latest update-site for version {{ github.ref }}"
    git push

Can you give that a try?

mattwynne commented 3 years ago

You might need to change the - uses: actions/checkout@v2 step to make sure you've pulled down the gh-actions branch as well as the current branch. Or maybe you just need a git fetch before the git checkout gh-pages line.

laeubi commented 3 years ago

@mattwynne thanks, thats correct the directory contains the data of the update-site. I'll give it a try.

laeubi commented 3 years ago

@mattwynne I have updated the code but it seems the add does not work and complains about nothing was added. Can you take a look if I'm missing something?

I have just modfied your aproach a bit by checkout both branches in different directories, and currently do not delete any old data.

laeubi commented 3 years ago

I think I found the issue, I simply removed the --update flag from the git add as it seems to only work if there is already a versioned file with this name (and new files are thus never added..)

laeubi commented 3 years ago

For the v.0 and v1. the update site is there and automatically updated:

laeubi commented 3 years ago

The new update-site hosting containing all versions will be https://cucumber.github.io/cucumber-eclipse/update-site/

Currently there are

that looks a bit nicer, @qvdk @mattwynne can anyone help migrating the more modern design to the https://cucumber.github.io/cucumber-eclipse/update-site/ ?

If that's done we should remove the content from the other sites and place a link to the new site there.

laeubi commented 3 years ago

This is how the update-site currently looks like: grafik

laeubi commented 3 years ago

The current main branch is deployed now to https://github.com/cucumber/cucumber-eclipse/tree/gh-pages/update-site/main and available as https://cucumber.github.io/cucumber-eclipse/update-site/main/ for usage inside eclipse.

The main is not included in the composite, so users will need to add this explicitly if desired as an extra update-site.