-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Add Codeberg Pages deploy docs #12723
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
dfdb592
add codeberg pages deploy
Wolffyhtl e897b75
Update codeberg.mdx
Wolffyhtl 9acecc1
Update codeberg.mdx
Wolffyhtl 1490294
Update codeberg.mdx
Wolffyhtl 67db170
Update codeberg.mdx
Wolffyhtl 0c46921
Create codeberg.mdx
Wolffyhtl 7366658
Delete src/content/docs/en/guides/deploy/codeberg.mdx
Wolffyhtl dcb8606
Update codeberg.mdx
Wolffyhtl bc57bcc
Update codeberg.mdx
Wolffyhtl 1019f8d
Update codeberg.mdx
Wolffyhtl fb3c123
Update codeberg.mdx
Wolffyhtl 71f9f2d
Update codeberg.mdx
Wolffyhtl 7bfe068
Update codeberg.mdx
Wolffyhtl 8d61ff2
Update codeberg.mdx
Wolffyhtl 64cae20
Create codeberg.mdx
Wolffyhtl 1cd68a8
Update codeberg.mdx
Wolffyhtl d3ef1b6
Update codeberg.mdx
Wolffyhtl 4ebd047
Update codeberg.mdx
Wolffyhtl f6aac18
Update codeberg.mdx
Wolffyhtl 887e2df
Update codeberg.mdx
Wolffyhtl 03a6442
Update codeberg.mdx
Wolffyhtl 1e9265b
Update codeberg.mdx
Wolffyhtl 9d05d8f
Delete src/content/docs/zh-cn/guides/deploy/codeberg.mdx
Wolffyhtl eee5c08
Update logos.ts
Wolffyhtl 37089df
Update codeberg.mdx
Wolffyhtl d1685a1
Update codeberg.mdx
Wolffyhtl 9bace24
Update codeberg.mdx
Wolffyhtl d841ca0
Update codeberg.mdx
Wolffyhtl 891d2dc
Update DeployGuidesNav.astro
sarah11918 f1e6461
Merge branch 'main' into main
sarah11918 d4558f6
Removed the steps component to make sure it builds without first
sarah11918 c5973c5
fix issues with Steps component
sarah11918 4a7f68c
Discard changes to Nav component because implementation has changed
sarah11918 4a64931
update frontmatter for new required properties
sarah11918 f90cc7d
Merge branch 'main' into main
sarah11918 ecec19f
fix typo in i18nReady property
sarah11918 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,136 @@ | ||
| --- | ||
| title: Deploy Your Astro Site to Codeberg Pages | ||
| description: How to use Codeberg Pages to deploy your Astro site to the web. | ||
| sidebar: | ||
| label: Codeberg Pages | ||
| type: deploy | ||
| logo: codeberg | ||
| supports: ['static'] | ||
| i18nReady: true | ||
| --- | ||
|
|
||
| import { Steps } from '@astrojs/starlight/components'; | ||
|
|
||
| You can use Codeberg Pages to host your Astro site directly from a repository on Codeberg. | ||
|
|
||
| ## How to deploy | ||
|
|
||
| You can use Codeberg CI to automatically build and deploy your site, publishing your Astro site to Codeberg Pages. For this, your source code must be hosted on Codeberg, and do the following: | ||
|
|
||
| <Steps> | ||
|
|
||
| 1. Open an issue [here](https://codeberg.org/Codeberg-e.V./requests/issues), tag it with `ci`, select `Expected Resource Usage` as `medium`, add your own Codeberg username in `I would also like the following users to be added`, and fill in the rest as you see fit. Wait for approval. | ||
|
|
||
| 2. Configure the [`site`](/en/reference/configuration-reference/#site) and [`base`](/en/reference/configuration-reference/#base) settings in the `astro.config.mjs` file. | ||
|
|
||
| ```js title="astro.config.mjs" ins={4-5} | ||
| import { defineConfig } from 'astro/config'; | ||
| export default defineConfig({ | ||
| site: 'https://<username>.codeberg.page', | ||
| base: '/<my-repo>', | ||
| outDir: 'dist', | ||
| publicDir: 'public', | ||
| }); | ||
| ``` | ||
|
|
||
| To make Astro treat your repository name (e.g., `/my-repo`) as the root directory of your website, you need a `base` value. | ||
| :::note | ||
| If your pages are served from the root directory, you don't need to set the `base` parameter. | ||
| ::: | ||
|
|
||
| The `base` value should be your repository name starting with a slash, such as `/my-blog`. This lets Astro understand that the root of your site is `/my-repo` instead of the default `/`. | ||
|
|
||
| :::caution | ||
| After configuring this value, all internal page links must be prefixed with your `base` value: | ||
| ```astro ins="/my-repo" | ||
| <a href="/my-repo/about">About</a> | ||
| ``` | ||
|
|
||
| See [Configuring the `base` value](/en/reference/configuration-reference/#base) | ||
| ::: | ||
|
|
||
| 3. In the repository root, create a `.forgejo` folder, and inside it create a `workflows` folder. | ||
|
|
||
| 4. In that folder, add an `astro.yaml` file. A sample of the file is as follows: | ||
| ```yml | ||
| name: Deploy Astro site to Pages | ||
|
|
||
| on: | ||
| # Runs on pushes targeting the default branch | ||
| push: | ||
| branches: | ||
| # If you want to build from a different branch, change it here. | ||
| - main | ||
| # Allows you to run this workflow manually from the Actions tab | ||
| workflow_dispatch: | ||
|
|
||
| jobs: | ||
| build: | ||
| # You can find the list of available runners on https://codeberg.org/actions/meta, or run one yourself. | ||
| runs-on: codeberg-tiny-lazy | ||
| steps: | ||
| - name: Clone the repository | ||
| uses: https://code.forgejo.org/actions/checkout@v4 | ||
| with: | ||
| submodules: recursive | ||
| fetch-depth: 0 | ||
| - name: check .domains files | ||
| run: | | ||
| git ls-files public/.domains | ||
| ls -la public/ | ||
| ls -la public/.domains || echo ".domains not found" | ||
| - name: Setup Node.js | ||
| uses: https://code.forgejo.org/actions/setup-node@v4 | ||
| with: | ||
| node-version: 22 | ||
| - name: Install dependencies | ||
| run: npm install | ||
| - name: Build Astro site | ||
| run: npm run build | ||
|
|
||
| - name: Upload generated files | ||
| uses: https://code.forgejo.org/actions/upload-artifact@v3 | ||
| with: | ||
| name: Generated files | ||
| path: dist/ | ||
| include-hidden-files: true | ||
|
|
||
| deploy: | ||
| needs: [ build ] | ||
| runs-on: codeberg-tiny-lazy | ||
| steps: | ||
| - name: Clone the repository | ||
| uses: https://code.forgejo.org/actions/checkout@v4 | ||
| with: | ||
| submodules: recursive | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Checkout the target branch and clean it up | ||
| run: | | ||
| git checkout pages || git switch --orphan pages | ||
| rm -Rfv $(ls -A | egrep -v '^(\.git|LICENSE)$') | ||
|
|
||
| - name: Download generated files | ||
| uses: https://code.forgejo.org/actions/download-artifact@v3 | ||
| with: | ||
| name: Generated files | ||
|
|
||
| - name: Publish the website | ||
| run: | | ||
| git config user.email codeberg-ci | ||
| git config user.name "Codeberg CI" | ||
| echo "=== Files being committed ===" | ||
| ls -la | ||
| git add . | ||
| git commit --allow-empty --message "Codeberg build for ${GITHUB_SHA}" | ||
| git push origin pages | ||
|
|
||
| ``` | ||
|
|
||
| 5. In the public directory, create a `.domains` file and enter `branch.repository.username.codeberg.page`—this is your default domain. If you want to add a custom domain, see this article: https://codeberg.org/Codeberg/pages-server/src/branch/main/README.md. | ||
|
|
||
| 6. Commit your changes and push to Codeberg. Codeberg will deploy automatically for you. | ||
|
|
||
| </Steps> | ||
|
|
||
| Your site should now be publishable! When you push updates to your Astro project's repository, the Codeberg CI pipeline will automatically deploy them. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.