Skip to content

Squash deployed gh-pages, relying on this repo for history#658

Merged
jni merged 1 commit into
napari:mainfrom
jni:squash-docs-deployment
Apr 10, 2025
Merged

Squash deployed gh-pages, relying on this repo for history#658
jni merged 1 commit into
napari:mainfrom
jni:squash-docs-deployment

Conversation

@jni

@jni jni commented Apr 8, 2025

Copy link
Copy Markdown
Member

In #621 and elsewhere, we are discussing the issue of autogenerating
screenshots in the docs. @Czaki brought up the issue that git is very
bad at handling binary blobs, so autogenerating images each time we
build the docs would rapidly blow up the repo clone size.

I think it's clear that we do want to autogenerate images, so the
cleanest solution in my opinion is to always squash when pushing to
our gh-pages site (napari.github.io). That history is not particularly
valuable, and indeed we have squashed it once before when it was getting
far too big to work with. Doing it automatically is actually an
improvement.

This PR achieves that by using the force_orphan option in the
peaceiris/actions-gh-pages action to always squash the edit history
before pushing to the gh-pages branch.

References

Zulip discussion:
https://napari.zulipchat.com/#narrow/channel/298358-working-group-documentation/topic/Meeting.202025-03-13.2F14/near/505543160

force_orphan documentation:
https://github.com/peaceiris/actions-gh-pages?tab=readme-ov-file#%EF%B8%8F-force-orphan-force_orphan

@github-actions github-actions Bot added the maintenance CI, dependencies, and other maintenance label Apr 8, 2025

@TimMonko TimMonko left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

woohoo! movement towards autogeneration. love it

@jni jni added this to the 0.6.0 milestone Apr 9, 2025
@TimMonko TimMonko added the Full docs preview/ready to merge Adding this label will trigger a full docs build for previewing changes. Also @napari-bot make html label Apr 9, 2025
@jni jni merged commit 5fc3cd7 into napari:main Apr 10, 2025
@github-actions github-actions Bot removed the Full docs preview/ready to merge Adding this label will trigger a full docs build for previewing changes. Also @napari-bot make html label Apr 10, 2025
@jni

jni commented Apr 10, 2025

Copy link
Copy Markdown
Member Author

@jni jni deleted the squash-docs-deployment branch April 10, 2025 02:07
@psobolewskiPhD

Copy link
Copy Markdown
Member

💩
https://napari.org gives 404

@psobolewskiPhD

Copy link
Copy Markdown
Member

@jni looks like this obliterated everything but dev:
https://github.com/napari/napari.github.io/tree/gh-pages

@psobolewskiPhD

Copy link
Copy Markdown
Member

Looks like force_orphan just uses the latest commit:
https://github.com/peaceiris/actions-gh-pages?tab=readme-ov-file#%EF%B8%8F-force-orphan-force_orphan
so yeah we lose everything else. I think we need to revert this and revert the last commit to gh_pages.

@psobolewskiPhD

Copy link
Copy Markdown
Member

Sorry that i missed this PR btw. My notifications have been overwhelmed with spam from my own docs fork.

@jni

jni commented Apr 10, 2025

Copy link
Copy Markdown
Member Author

um. Shit.

@jni

jni commented Apr 10, 2025

Copy link
Copy Markdown
Member Author

ok, the minimal damage control rn is to redirect napari.org to dev. Let me add that.

@jni

jni commented Apr 10, 2025

Copy link
Copy Markdown
Member Author

ok I have history locally up to 0.5.4.

@jni

jni commented Apr 10, 2025

Copy link
Copy Markdown
Member Author

My gif was so appropriate

@psobolewskiPhD

Copy link
Copy Markdown
Member

Ooof, can't even revert it because history is gone. 😬

@jni

jni commented Apr 10, 2025

Copy link
Copy Markdown
Member Author

Looks like force_orphan just uses the latest commit:
peaceiris/actions-gh-pages#%EF%B8%8F-force-orphan-force_orphan
so yeah we lose everything else. I think we need to revert this and revert the last commit to gh_pages.

Using the latest commit is what we want if the latest commit contains all the folders, which I thought it did.

Unfortunately this clobbers the whole history so there is no going back. However we may only lose 0.5.5 and 0.5.6 in the worst case. I feel very dumb for not doing git clone before this. 🤦

@jni

jni commented Apr 10, 2025

Copy link
Copy Markdown
Member Author

ok let me first revert this so we can modify things going forward without them getting clobbered.

jni added a commit to jni/napari-docs that referenced this pull request Apr 10, 2025
@jni

jni commented Apr 10, 2025

Copy link
Copy Markdown
Member Author

See #663. Could I have a quick merge please? 🙏

@psobolewskiPhD

Copy link
Copy Markdown
Member

@jni approved, but i'm about to hit the hay -- sorry! 😞

@jni

jni commented Apr 10, 2025

Copy link
Copy Markdown
Member Author

haha better than last time when I clobbered the history and then myself hit the hay 🤣 Have a good night!

This may save us, will explore now:

https://medium.com/git-tips/githubs-reflog-a9ff21ff765f

@jni

jni commented Apr 10, 2025

Copy link
Copy Markdown
Member Author

sleep tight! 😂

@TimMonko

Copy link
Copy Markdown
Contributor

This seems useful -- or is this that backup you mentioned @jni?

It has 0.5.6 though

https://github.com/napari/napari.github.io/tree/gh-pages-backup-2025-04-08

@jni

jni commented Apr 10, 2025

Copy link
Copy Markdown
Member Author

Oh sweet bejeebus.

https://github.com/napari/napari.github.io/tree/gh-pages-backup-2025-04-08

😂

for the record, I followed the instructions from the medium post, but the curl POST command wouldn't work (probably because of 2FA on my account), but I followed the instructions to the docs and used the GH CLI instructions:

https://docs.github.com/en/rest/git/refs?apiVersion=2022-11-28#create-a-reference

# GitHub CLI api
# https://cli.github.com/manual/gh_api

gh api \
  --method POST \
  -H "Accept: application/vnd.github+json" \
  -H "X-GitHub-Api-Version: 2022-11-28" \
  /repos/OWNER/REPO/git/refs \
   -f "ref=refs/heads/featureA" -f "sha=aa218f56b14c9653891f9e74264a383fa43fefbd"

@jni

jni commented Apr 10, 2025

Copy link
Copy Markdown
Member Author

I just made that right now @TimMonko thanks to the above links 😅 😅 😅

jni added a commit that referenced this pull request Apr 10, 2025
@TimMonko

Copy link
Copy Markdown
Contributor

Oh wonderful. I am currently cloning it too, just in case. I won't know what to do with it should things go awry but I'm here for you (while fixing my 6th bike flat of the spring gahhh)

@jni

jni commented Apr 10, 2025

Copy link
Copy Markdown
Member Author

actually, somewhat interestingly, I just saw that the gh-pages deployment action gives you an artifact:

CleanShot 2025-04-10 at 13 26 15@2x

So grabbing from that would have been another option. 😅 Good to know for the future.

https://github.com/napari/napari.github.io/actions/runs/14371590037

Anyway, we are back in business!!!! 😅 Everyone can go back to their normal levels of anxiety now. 😂

@jni

jni commented Apr 10, 2025

Copy link
Copy Markdown
Member Author

I went a bit too far back on the restore (didn't want to waste time restoring the same commit 😅) so we've lost Tim in the about page. Small price to pay. 😜

No, in seriousness, now that #663 is merged, the very next deploy from here should fix that. 😅

@TimMonko

Copy link
Copy Markdown
Contributor

Lol I'm such a dingbat I was already using the docs for the past few minutes without realizing it ever went down 🙃
My anxiety was clearly not high enough. I'm over here just chillin

@TimMonko

Copy link
Copy Markdown
Contributor

The lesson here is that sometimes you have to be the villain in order to become the hero

@melissawm

Copy link
Copy Markdown
Member

Oh cheese I'm so sorry I missed all the fun here 😆 Just trying to catch up on notifications...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintenance CI, dependencies, and other maintenance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants