diff --git a/.github/example-workflows/gh-pages.yml b/.github/example-workflows/gh-pages.yml new file mode 100644 index 00000000000..7b41266c572 --- /dev/null +++ b/.github/example-workflows/gh-pages.yml @@ -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 diff --git a/README.md b/README.md index fac9f706d61..4d6243aafd0 100644 --- a/README.md +++ b/README.md @@ -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). @@ -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 \ No newline at end of file