Document the new method for git-pages deployments

This commit is contained in:
Daphne Preston-Kendal
2026-01-09 12:15:00 +01:00
parent 0a407cc66d
commit ade38e14ee

View File

@@ -115,15 +115,89 @@
</div>
<div class="content">
<h3>Set up your website (legacy method)</h3>
<p>
<strong>This is currently the only method which supports custom domains.</strong> Support for custom domains with the new method is coming soon.
</p>
<details>
<summary>Show the legacy method</summary>
<div class="card" style="max-width: 80em; margin: 0 auto;">
<div class="row" style="gap: var(--content-and-card-spacing)">
<div class="col-lg">
<h4 class="text-center">
<span class="codeberg-number-circle">1</span>
Set up your repository
</h4>
<p>
Create a public repository named <code class="code">pages</code> to make the site available at the main subdomain.
</p>
<div class="codeberg-divider"><hr>or<hr></div>
<p>
Create a branch <code class="code">pages</code> in a public repository:<br>
<code class="code">git switch --orphan pages</code><br><code class="code">git rm --cached -r .</code>
</p>
</div>
<div class="col-lg">
<h4 class="text-center">
<span class="codeberg-number-circle">2</span>
Upload your files
</h4>
<p>
Push your static content, HTML, style, fonts, images or anything else.
</p>
<!--<div class="codeberg-divider">or</div>
<p>
Push the source for your page based on any static site generator, and <a href="">compile it with Codeberg CI</a>.
</p>-->
</div>
<div class="col-lg">
<h4 class="text-center">
<span class="codeberg-number-circle">3</span>
You're done!
</h4>
<p>
Access your new website using this link:<br>
<code class="code">https://USERNAME.codeberg.page[/REPOSITORY][/@BRANCH]</code>
</p>
<div class="codeberg-divider"><hr>or<hr></div>
<p>
To use a custom domain, create a file <code class="code">.domains</code> in your repository with the domain name you wish to use.
</p>
<p>
Then, add a DNS record for that domain:<br>
<code class="code">CNAME [[<i>branch</i>.]<i>repo</i>.]<i>user</i>.codeberg.page.</code>
</p>
<p>
Or for apex domains where CNAME doesn't work:<br>
<code class="code">ALIAS codeberg.page.</code><br>
<code class="code">TXT [[<i>branch</i>.]<i>repo</i>.]<i>user</i>.codeberg.page</code>
</p>
<p>
If ALIAS isn't supported, use add the <code class="code">TXT</code> record as described above, and use <code class="code">A</code>+<code class="code">AAAA</code> as following:
</p>
<div class="alert" role="alert">
Warning: Our IP addresses have changed in April 2025.
Please make sure to update your DNS records accordingly for your existing domains.
</div>
<p>
<code class="code">A 217.197.84.141</code><br>
<code class="code">AAAA 2a0a:4580:103f:c0de::2</code>
</p>
</div>
</div>
</div>
</details>
<h3>Set up your website (new method without CI)</h3>
<div class="card" style="max-width: 80em; margin: 0 auto;">
<div class="row" style="gap: var(--content-and-card-spacing)">
<div class="col-lg">
<h4 class="text-center">
<span class="codeberg-number-circle">1</span>
Set up your repository
Set up your&nbsp;repository
</h4>
<p>
Create a public repository named <code class="code">pages</code> to make the site available at the main subdomain.
Create a public repository named <code class="code">pages</code> with a branch called <code class="code">pages</code> to make the site available at the main subdomain.
</p>
<div class="codeberg-divider"><hr>or<hr></div>
<p>
@@ -134,52 +208,48 @@
<div class="col-lg">
<h4 class="text-center">
<span class="codeberg-number-circle">2</span>
Upload your files
Set up deployment
</h4>
<p>
Push your static content, HTML, style, fonts, images or anything else.
In the <b>Settings</b> for your repository, go to <b>Webhooks</b> and click <b>Add webhook</b>.
</p>
<p>
Select <b>Forgejo</b> from the drop down list of webhook types.
</p>
<p>
Set the <b>Target URL</b> to <code class="code">https://USERNAME.codeberg.page/REPOSITORY</code>, replacing <code class="code">USERNAME</code> with your user or organization name and <code class="code">REPOSITORY</code> with the name of your repository.
(If your repository is called <code class="code">pages</code>, omit it.)
</p>
<p>
Set the <b>Branch filter</b> to <code class="code">pages</code>.
</p>
<p>
Click <b>Add webhook</b>.
</p>
</div>
<div class="col-lg">
<h4 class="text-center">
<span class="codeberg-number-circle">3</span>
Upload your files and youre&nbsp;done!
</h4>
<p>
Push your static content, HTML, style, fonts, images or anything else. They will be accessible at <code class="code">https://USERNAME.codeberg.page[/REPOSITORY]</code>.
</p>
<!--<div class="codeberg-divider">or</div>
<p>
Push the source for your page based on any static site generator, and <a href="">compile it with Codeberg CI</a>.
</p>-->
</div>
<div class="col-lg">
<h4 class="text-center">
<span class="codeberg-number-circle">3</span>
You're done!
</h4>
<p>
Access your new website using this link:<br>
<code class="code">https://USERNAME.codeberg.page[/REPOSITORY][/@BRANCH]</code>
</p>
<div class="codeberg-divider"><hr>or<hr></div>
<p>
To use a custom domain, create a file <code class="code">.domains</code> in your repository with the domain name you wish to use.
</p>
<p>
Then, add a DNS record for that domain:<br>
<code class="code">CNAME [[<i>branch</i>.]<i>repo</i>.]<i>user</i>.codeberg.page.</code>
</p>
<p>
Or for apex domains where CNAME doesn't work:<br>
<code class="code">ALIAS codeberg.page.</code><br>
<code class="code">TXT [[<i>branch</i>.]<i>repo</i>.]<i>user</i>.codeberg.page</code>
</p>
<p>
If ALIAS isn't supported, use add the <code class="code">TXT</code> record as described above, and use <code class="code">A</code>+<code class="code">AAAA</code> as following:
</p>
<div class="alert" role="alert">
Warning: Our IP addresses have changed in April 2025.
Please make sure to update your DNS records accordingly for your existing domains.
</div>
<p>
<code class="code">A 217.197.84.141</code><br>
<code class="code">AAAA 2a0a:4580:103f:c0de::2</code>
</p>
</div>
</div>
</div>
<h3>Set up your website (new method with CI)</h3>
<p>
If you use a static site generator like Jekyll, Hugo, or any other similar tool, you can integrate deployment into the <a href="https://docs.codeberg.org/ci/actions/">Forgejo Actions</a> workflow which builds your site instead of using the webhook.
</p>
<p>
To learn how to do this, see <a href="https://docs.codeberg.org/codeberg-pages/">our documentation</a>.
</p>
</div>
</div>
</div>