Skip to content

搞英语 → 看世界

翻译英文优质信息和名人推特

Menu
  • 首页
  • 作者列表
  • 独立博客
  • 专业媒体
  • 名人推特
  • 邮件列表
  • 关于本站
Menu

更新 Codeberg 页面静态站点

Posted on 2023-12-22

opengraph.png

早在三月份,我就可以访问使用 Woodpecker CI 的 Codeberg CI。我写了一篇文章来帮助在平台上设置 11ty 静态站点生成器。此过程使用两个独立的存储库,一个用于源代码,另一个用于提供 HTML 文件。 CI 已经克隆了源存储库,然后我们安装了依赖项、构建了站点、设置了原始 URL 并推送了我们的内容。最近,我注意到管道多次无法运行,或者平台正在维护。

我的第一个想法应该在 CI 上工作,但在测试中,整个平台都出现了问题,是克隆主分支,将页面分支克隆为_site ,分别构建和提交两个分支。我们来看看过程。我将使用 PowerShell 来处理一些变量,但这很容易移植。

设置

我最近制作了一个名为“Dad Jokes”的网站,并将其托管在Codeberg上。我的存储库有一个主分支和一个页面分支。这个页面分支就像 GitHub 的专用静态文件托管。

 # Clone main source $ git clone https: / / codeberg . org/cjerrington/dadjokes . git # Clone the 'pages. branch as _site. $ git clone - b pages https: / / codeberg . org/cjerrington/dadjokes . git _site # Install 11ty and dependencies $ npm i # To see the compiled site locally $ npm run start # Build will go to _site and update the built pages $ npm run build

出版

这就是巧妙的东西发挥作用的地方。就像我们可以克隆特定分支一样,您也可以将更改推送到这些分支。

 # Get the current date $ $now = get-date - Format "yyyy-MM-dd" # Build the site, if you have not already. # Should be in the root of the source to build $ npm run build # Add source code changes to git, commit, and push $ git add . $ git commit - m "Update dad jokes on $now " $ git push - u origin main # Now to add build changes to pages $ cd _site $ git add . $ git commit - m "Update dad jokes on $now " $ git push - u origin pages

由于您克隆了页面分支,因此原点仍应设置为该分支。但由于我们要在源/主分支到 _site/pages 之间移动,我认为最好确保您推送到正确的位置。这也可以在git 文档中找到。

啄木鸟

由于 Woodpecker 使用源代码存储库,因此它已经在下载源代码。我们可以保留与现在相同的 git clone -b 页面,但只需要指定一个存储库,即项目。我认为一旦保证了 Codeberg CI 的稳定性,我也可以更新那里的流程。在那之前,这可能是我的流程,并且还保持存储库的数量跟上。

Codeberg 托管 DNS

Codeberg有一个默认的用户Pages存储库,它是每个用户的默认存储库。但是,每个存储库都可以为该项目的静态托管文件拥有自己的页面分支。

根据Codeberg Pages,我设置了 CNAME 并在页面分支中添加了.domains文件。经过一段时间后,让 Codeberg 设置静态页面路由并颁发 SSL 证书,网页开始工作了!

 $ Resolve-DnsName - Name dadjokes . claytonerrington . com | Select Name , Type , NameHost , IPAddress Name Type NameHost IPAddress -- -- -- -- -- -- -- -- -- -- -- -- - dadjokes . claytonerrington . com CNAME dadjokes . cjerrington . codeberg . page dadjokes . cjerrington . codeberg . page AAAA 2001:67c:1401:20f0::1 dadjokes . cjerrington . codeberg . page A 217 . 197 . 91 . 145

一切都检查完毕,现在可以保持网站更新。

原文: https://claytonerrington.com/blog/codeberg-pages/

本站文章系自动翻译,站长会周期检查,如果有不当内容,请点此留言,非常感谢。
  • Abhinav
  • Abigail Pain
  • Adam Fortuna
  • Alberto Gallego
  • Alex Wlchan
  • Answer.AI
  • Arne Bahlo
  • Ben Carlson
  • Ben Kuhn
  • Bert Hubert
  • Bits about Money
  • Brian Krebs
  • ByteByteGo
  • Chip Huyen
  • Chips and Cheese
  • Christopher Butler
  • Colin Percival
  • Cool Infographics
  • Dan Sinker
  • David Walsh
  • Dmitry Dolzhenko
  • Dustin Curtis
  • Elad Gil
  • Ellie Huxtable
  • Ethan Marcotte
  • Exponential View
  • FAIL Blog
  • Founder Weekly
  • Geoffrey Huntley
  • Geoffrey Litt
  • Greg Mankiw
  • Henrique Dias
  • Hypercritical
  • IEEE Spectrum
  • Investment Talk
  • Jaz
  • Jeff Geerling
  • Jonas Hietala
  • Josh Comeau
  • Lenny Rachitsky
  • Liz Danzico
  • Lou Plummer
  • Luke Wroblewski
  • Matt Baer
  • Matt Stoller
  • Matthias Endler
  • Mert Bulan
  • Mostly metrics
  • News Letter
  • NextDraft
  • Non_Interactive
  • Not Boring
  • One Useful Thing
  • Phil Eaton
  • Product Market Fit
  • Readwise
  • ReedyBear
  • Robert Heaton
  • Ruben Schade
  • Sage Economics
  • Sam Altman
  • Sam Rose
  • selfh.st
  • Shtetl-Optimized
  • Simon schreibt
  • Slashdot
  • Small Good Things
  • Taylor Troesh
  • Telegram Blog
  • The Macro Compass
  • The Pomp Letter
  • thesephist
  • Thinking Deep & Wide
  • Tim Kellogg
  • Understanding AI
  • 英文媒体
  • 英文推特
  • 英文独立博客
©2025 搞英语 → 看世界 | Design: Newspaperly WordPress Theme