Skip to content
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

add example workflow to deploy to gh-pages #234

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .github/example-workflows/gh-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: CI
on: push
jobs:
deploy:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Git checkout
uses: actions/checkout@v1
with:
submodules: true

- name: Setup hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: 'latest'
extended: true

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: '18'
- run: npm install
- run: npm run build:production

- name: Deploy
uses: peaceiris/actions-gh-pages@v3
if: github.ref == 'refs/heads/main'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./public
# publish_branch: gh-pages # default: gh-pages
# cname: www.example.com # default: no custom domain
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ If you want to do SCSS edits and want to publish these, you need to install `Pos
npm install
```

## Deployment on GitHub pages

This repo ships with a [GitHub action] that allows you to deploy your site to [GitHub Pages].

To enable automatic deployment on push to main branch of your repo, copy the corresponding [workflow file](.github/example-workflows/gh-pages.yml) then it's ready to go.

## Running the website locally

Building and running the site locally requires a recent `extended` version of [Hugo](https://gohugo.io).
Expand Down Expand Up @@ -152,3 +158,5 @@ See this [section](https://www.docsy.dev/docs/get-started/docsy-as-module/instal
[Hugo theme module]: https://gohugo.io/hugo-modules/use-modules/#use-a-module-for-a-theme
[Netlify]: https://netlify.com
[Docker Compose documentation]: https://docs.docker.com/compose/gettingstarted/
[GitHub Pages]: https://docs.github.com/en/pages
[GitHub action]: https://docs.github.com/en/actions