ci(docs): Replace preview docs workflow with Grebedoc #2538
No reviewers
Labels
No labels
Abandoned
Blocked
Bug
Changelog
Added
Changelog
Missing
Changelog
None
Cherry-picking
Compliance
Database
Dependencies
Dependencies/Renovate
Difficulty
Easy
Difficulty
Hard
Difficulty
Medium
Documentation
Enhancement
Good first issue
Help wanted
Inherited
Matrix/Administration
Matrix/Appservices
Matrix/Auth
Matrix/Client
Matrix/Core
Matrix/E2EE
Matrix/Federation
Matrix/Hydra
Matrix/MSC
Matrix/Media
Matrix/T&S
Merge
Merge/Manual
Merge/Squash
Meta
Meta/CI
Meta/Packaging
Priority
Blocking
Priority
High
Priority
Low
Security
Status
Confirmed
Status
Duplicate
Status
Invalid
Status
Needs Investigation
Support
bob the builder
No milestone
No assignees
4 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
continuwuation/continuwuity!2538
Loading…
Reference in a new issue
No description provided.
Delete branch "julian45/continuwuity:julian/docs/grebedoc"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This pull request would replace preview doc deployments only with Grebedoc, to help test the waters there without breaking production docs.
If successful, it helps address #2500, but given this first stage, I'm not putting the
Fixesstatement here.Given the way GitHub Actions works, this will likely only take effect beginning with the next PR opened after this is merged.
Prerequisites
The following DNS records need to be deployed for this to work, in order to prove domain control to Grebedoc. In order to allow the records to propagate around the internet, I suggest a delay of anywhere from 15 to 60 minutes between creating these records and merging this PR.
CNAMEpointingpreview.continuwuity.orgtogrebedoc.dev_git-pages-repository.preview.continuwuity.orgwhose content ishttps://forgejo.ellis.link/continuwuation/continuwuity.git_git-pages-forge-allowlist.preview.continuwuity.org, whose content is alsohttps://forgejo.ellis.link/continuwuation/continuwuity.gitThis corresponds to "Method A" in the Grebedoc deployment info, combined with docs pages from here and here (Codeberg Pages uses the same tool under the hood as Grebedoc, namely git-pages).
I hope it's sufficient to make this deployment method work; if not, there's another method that would require a CI secret to be added.
Pull request checklist:
mainbranch, and the branch is named something other thanmain.myself, if applicable. This includes ensuring code compiles.
lgtm, this is basically exactly how ive done it for my own deployment
@silversys wrote in #2538 (comment):
Yeah, it looks like you use Grebedoc's "Method B", the one I mentioned involving a secret stored in CI. Crossing my fingers that Method A works, as hopefully that makes things a bit smoother :3
yeah, but i believe having the dns records and such is necessary either way. ill be honest and say i cant quite remember why i did method B over A, but im sure A works too
oh i remember! method A wants:
which i didnt wanna do, i wanted to build in CI and publish the built files without direct publishing of a branch. i cant remember if A lets you do push-based (the way youre doing here), but im sure its fine
@ -68,0 +70,4 @@# apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}# command: pages deploy ./doc_build --branch="${{ github.head_ref || github.ref_name }}" --commit-dirty=true --project-name="${{ vars.CLOUDFLARE_PROJECT_NAME }}"- name: Deploy to Grebedoc (Preview)i would like to at the very least also add
expires, to ensure any published preview gets deleted after e.g. two weeks. we can always re-deploy if we ever need to by running the PR action againdone in
41db43eb49:3some more things i thought of, once these are fixed i think i'd be at least willing to give it a try. i am still unsure if the deployment would work with method A, but i guess we'll find out
@ -68,0 +68,4 @@# with:# accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}# apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}# command: pages deploy ./doc_build --branch="${{ github.head_ref || github.ref_name }}" --commit-dirty=true --project-name="${{ vars.CLOUDFLARE_PROJECT_NAME }}"this all should be removed instead of commented out, since it will still exist in git history if we ever need to undo it
done 👍
@ -70,2 +77,2 @@apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}command: pages deploy ./doc_build --branch="${{ github.head_ref || github.ref_name }}" --commit-dirty=true --project-name="${{ vars.CLOUDFLARE_PROJECT_NAME }}"site: https://preview.continuwuity.orgpath: "pr/${{ forgejo.event.number }}"we'll need to make sure the site is built with URLs relative to this too, otherwise every link will be broken. https://rspress.rs/guide/basic/deploy#project-base-path-configuration
unsure if this can be changed at compile time, but it would need to be changed
This'll be a little tougher to do at compile time, but I'm looking into that over the next couple of days.
If it's anything like vite you can use env vars from compile time
Yeah, that's pretty much the idea I had in mind. Just haven't had time to dive into it yet
As of
01ba53db8a, There Has Been An Attempt™41db43eb491c842df707Changes have been made to DNS:
1c842df7074ac7acc29526ce65b8ac560844ab3a560844ab3a01ba53db8a01ba53db8abfb7d16f56bfb7d16f56b33e54cc01two smaller things, otherwise lgtm
@ -2,2 +1,2 @@import { pluginSitemap } from '@rspress/plugin-sitemap';import { pluginClientRedirects } from '@rspress/plugin-client-redirects';import {defineConfig} from '@rspress/core';import {pluginClientRedirects} from '@rspress/plugin-client-redirects';nitpick: formatting on the
{}to have spaces inside@ -4,0 +2,4 @@import {pluginClientRedirects} from '@rspress/plugin-client-redirects';const isPreview: boolean = process.env.DEPLOY_ENV === 'preview';const sitePath: string | undefined = process.env.SITE_PATH;change this to
string, and use?? '/'immediately, avoiding the possibly undefined variableb33e54cc01to8192426784from me in dev room:
8192426784f3289f150cHi! Grebedoc and git-pages maintainer here (I noticed your deploy while doing a regular audit of new uploads). Please feel free to tag me directly if you have any issues with either.
Oh, it looks like you have some issues with the deploy: