Skip to content

Commit

Permalink
Add GitHub Actions and Custom Directory sections to the Publishing do…
Browse files Browse the repository at this point in the history
…cs page (#160)
  • Loading branch information
matyasjay authored Nov 16, 2024
1 parent 2bd13c2 commit 2b6c7f5
Showing 1 changed file with 35 additions and 1 deletion.
36 changes: 35 additions & 1 deletion website/docs/Publishing.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ If you are using git and Github pages, you can publish your doc website with one

Otherwise, you can run `moonwave build`, and your built website will be in a folder called `build` in your project directory.

Additionally, you can also specify the `--out-dir [path]` argument to set the build directory to a different path other than the default `build` directory.

:::caution
Remember to add the `build` folder to your `.gitignore`!
:::
Expand Down Expand Up @@ -46,4 +48,36 @@ Even if you are using Github Pages, and:

## Github Pages Custom Domain CNAME file

Github Pages requires you to create a CNAME file in your website to host on a custom domain. You should create this file at `yourProjectRoot/.moonwave/static/CNAME` (create the folders if they don't exist) and put your domain in the file.
Github Pages requires you to create a CNAME file in your website to host on a custom domain. You should create this file at `yourProjectRoot/.moonwave/static/CNAME` (create the folders if they don't exist) and put your domain in the file.

## Using GitHub Actions

You can create a GitHub Actions workflow to automatically publish your docs webiste to GitHub Pages. To begin, you need to create a new workflow in the `.github/workflows` directory of your repository that will build and publish your website.

Here is an example of such a workflow where the job will run on each push to the `master` branch:

```yaml
# .github/workflows/publish-docs.yml
name: publish-docs
on:
push:
branches: ["master"]
jobs:
status:
runs-on: ubuntu-latest
name: Publish docs to GitHub Pages
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "22"
- run: npm i -g moonwave@latest
- name: Publish
run: |
git remote set-url origin https://git:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git
git config --global user.email "[email protected]"
git config --global user.name "github-actions-bot"
moonwave build --publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```

0 comments on commit 2b6c7f5

Please sign in to comment.