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

Make PR previews work #185

Closed
spoenemann opened this issue Sep 6, 2023 · 9 comments
Closed

Make PR previews work #185

spoenemann opened this issue Sep 6, 2023 · 9 comments
Labels
deployment Issue about the deployment process help wanted Extra attention is needed

Comments

@spoenemann
Copy link
Contributor

PR previews using rossjrw/pr-preview-action don't work yet because they are deployed to subpaths like https://eclipse-langium.github.io/langium-website/pr-preview/pr-181/.

In addition, there's the permissions issue mentioned in #181.

@spoenemann spoenemann added the deployment Issue about the deployment process label Sep 6, 2023
@spoenemann spoenemann added the help wanted Extra attention is needed label Dec 12, 2023
@netomi
Copy link
Contributor

netomi commented Dec 12, 2023

The permissions problem can be solved.
The main problem is that the current deployment mechanism uses GitHub Actions, whereas the pr-preview-action commits to the gh-pages branch which is the legacy way to deploying.

The 2 mechanisms dont work together, as GH will not deploy from the gh-pages branch anymore, thus anything committed there will not be visible.

@netomi
Copy link
Contributor

netomi commented Dec 12, 2023

It might be possible to uses the deploy-pages action: https://github.com/actions/deploy-pages

it has a beta feature called preview.

I will test it out in a fork.

@netomi
Copy link
Contributor

netomi commented Dec 12, 2023

So I tested the preview feature of the deploy-pages actions and it is still in closed alpha: actions/deploy-pages#180

This led me to this discussion page:

https://github.com/orgs/community/discussions/7730

Where somebody was presenting his workaround:

https://github.com/orgs/community/discussions/7730#discussioncomment-7395421

which looks pretty solid and doable:

@netomi
Copy link
Contributor

netomi commented Dec 12, 2023

Ok so I managed now to come up with a setup to deploy previews of your site.

Take a look at this PR:

https://github.com/netomi/langium-website/pull/6

It has a link to the preview site available at https://netomi.github.io/langium-previews/pr-previews/pr-6/

What happens:

  • when a PR is opened, a preview workflow runs that builds the page from this PR (needed to add relativeURLs = true to the config.toml file)
  • the build page is transferred to the langium-previews repo to a branch 'previews' in a subdir pr-previews/pr-X
  • the langium-previews repo has GH pages activated by deploying from the 'previews' branch
  • so everytime something is pushed to the previews branch, the page gets deployed (this might take 1-2 mins)

similarly, if a PR is closed, the preview site will be removed from the langium-previews repo again.

Something that I still have to test is to support PRs from outside collaborators. I think this will be possible using the pull request target trigger, but need to check it.

Maybe this solution is something you are looking for? In the long term, hopefully GitHub supports deploying of previews but there is no information when this will be available, for the time being this might be a viable solution.

@spoenemann
Copy link
Contributor Author

Wow, cool -- thanks!

So this would require to create a new repo langium-previews in the GitHub org?

@netomi
Copy link
Contributor

netomi commented Dec 13, 2023

yes, a separate repo is required to host the preview deployments.

@spoenemann
Copy link
Contributor Author

Ok the solution looks good. Please apply it to this repo.

Thank you for the great support! 🙏

@msujew
Copy link
Member

msujew commented Dec 14, 2023

@netomi Thanks a lot for looking into this! This seems to work pretty well. See here. We can fix the showcase related issues on our own :)

@msujew msujew closed this as completed Dec 14, 2023
@netomi
Copy link
Contributor

netomi commented Dec 14, 2023

nice that it works now. I did not test the whole site for relative links, but I guess you can fix that much better than myself. The playground is really impressive imho.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deployment Issue about the deployment process help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants