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

Re-enable GitHub Pages deploy workflow #213

Merged
merged 2 commits into from
Sep 19, 2023
Merged

Re-enable GitHub Pages deploy workflow #213

merged 2 commits into from
Sep 19, 2023

Conversation

pocka
Copy link
Collaborator

@pocka pocka commented Sep 12, 2023

This PR re-enables a GitHub Actions workflow that builds example Storybook then deploys it to GitHub Pages. I have also changed the deploy action to the new official action from third party one (5500a94).

Fix #187.

GitHub now offers an official way to deploy static site to GitHub Pages
using GitHub Actions. Using an official method is preferable because
we can't assume the API keeps backwards compatibility (esp. GitHub).
In mid-to-long term, I believe this transition reduces future
maintenance costs.
@ghengeveld ghengeveld requested review from yannbf, ndelangen, thafryer and shilman and removed request for ghengeveld September 14, 2023 18:37
@ndelangen
Copy link
Member

Can we test this before merging @pocka ?

it LGTM.

@pocka
Copy link
Collaborator Author

pocka commented Sep 15, 2023

Can we test this before merging @pocka ?

Merged this branch locally then pushed to my temporary fork (will remove once this PR got merged).

https://github.com/pocka/addon-designs-ci-test/actions/runs/6197014978
https://pocka.github.io/addon-designs-ci-test/?path=/docs/docs-quick-start--docs

@yannbf
Copy link
Member

yannbf commented Sep 19, 2023

This looks great! thank you so much as always @pocka <3 <3

@yannbf yannbf added the skip-release Preserve the current version when merged label Sep 19, 2023
@yannbf yannbf merged commit 8ff94a0 into master Sep 19, 2023
3 checks passed
@yannbf yannbf deleted the chore/ghpage-release branch September 19, 2023 09:45
@pocka
Copy link
Collaborator Author

pocka commented Sep 19, 2023

It seems the deployment failed due to the existing gh-pages branch?

@ndelangen
Copy link
Member

@yannbf looks like you fixed it?

@yannbf
Copy link
Member

yannbf commented Oct 12, 2023

@ndelangen No I did not. The deployment seems broken still.

@pocka the error is as follows:

HttpError: Invalid deployment branch and no branch protection rules set in the environment. Deployments are only allowed from gh-pages

So probably the script has to run from the gh-pages branch always? I don't know how the GH action works. Maybe this GH Action is better, because it seems more maintained? https://github.com/JamesIves/github-pages-deploy-action

@pocka
Copy link
Collaborator Author

pocka commented Oct 13, 2023

I found an issue with the exact same error message in the Action's repo:
actions/deploy-pages#108

So probably the script has to run from the gh-pages branch always?

No, gh-pages branch is a "hack" GitHub using so it can host files on the branch as a GitHub Pages website content. Traditional Actions (including the previous Action this repo has used) pushes built files to gh-pages branch then GitHub hosts its content.

---
title: Legacy pipeline
---
flowchart LR
  master["Default branch"]
  action["GitHub Actions"]
  ghpages["gh-pages branch"]
  hosting["GitHub Pages"]

  master -. Trigger .-> action
  action -- Push built files --> ghpages
  hosting -- Serve --> ghpages
Loading
---
title: New pipeline
---
flowchart LR
  master["Default branch"]
  action["GitHub Actions"]
  storage["Some GitHub internal storage idk"]
  hosting["GitHub Pages"]

  master -. Trigger .-> action
  action -- Place built files --> storage
  hosting -- Serve --> storage
Loading

Maybe this GH Action is better, because it seems more maintained? https://github.com/JamesIves/github-pages-deploy-action

I don't think it has/will have better future maintanance and quality. This my impression is from glancing at README and existence of "hacktoberfest" tag on repo description. The actions/deploy-pages action is provided offically from GitHub and therefore follows or enforces best-practice such as branch protection rules, which reduces operational/security burden as a result.

Reading the above issue and the Action's README, changing deploy source to "GitHub Actions" from repository setting page would solve the problem. Deleting gh-pages branch or configuring branch protection rules for the branch might be necessary also.

Screenshot 2023-10-13 at 14 31 09

@yannbf
Copy link
Member

yannbf commented Dec 1, 2023

Thank you so much @pocka! Changing the source and removing gh-pages branch fixed it. It's now working as intended.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip-release Preserve the current version when merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Docs and demo page is 404
3 participants