storybookjs / addon-designs

A Storybook addon that embeds Figma, websites, or images in the addon panel.
https://storybookjs.github.io/addon-designs
MIT License
869 stars 73 forks source link

Re-enable GitHub Pages deploy workflow #213

Closed pocka closed 12 months ago

pocka commented 1 year ago

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 (5500a94c3923c945fc891f2bd801b3c5da625d39).

Fix #187.

ndelangen commented 12 months ago

Can we test this before merging @pocka ?

it LGTM.

pocka commented 12 months ago

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 commented 12 months ago

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

pocka commented 12 months ago

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

ndelangen commented 12 months ago

@yannbf looks like you fixed it?

yannbf commented 11 months ago

@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 commented 11 months ago

I found an issue with the exact same error message in the Action's repo: https://github.com/actions/deploy-pages/issues/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
---
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

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 commented 9 months ago

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