mirror of
https://github.com/status-im/actions-gh-pages.git
synced 2025-02-21 09:18:08 +00:00
114 lines
3.2 KiB
Markdown
114 lines
3.2 KiB
Markdown
[](https://github.com/peaceiris/actions-gh-pages/blob/master/LICENSE)
|
|
[](https://github.com/peaceiris/actions-gh-pages/releases/latest)
|
|
[](https://github.com/peaceiris/actions-gh-pages/releases)
|
|
[](https://github.com/peaceiris/actions-gh-pages/actions)
|
|
|
|
<img width="400" alt="GitHub Actions for deploying to GitHub Pages with Static Site Generators" src="./images/ogp.svg">
|
|
|
|
|
|
|
|
## GitHub Actions for deploying to GitHub Pages
|
|
|
|
A GitHub Action to deploy your static site to GitHub Pages with [Static Site Generators] (Hugo, MkDocs, Gatsby, GitBook, etc.)
|
|
|
|
[Static Site Generators]: https://www.staticgen.com/
|
|
|
|
|
|
|
|
## Getting started
|
|
|
|
### Create `.github/workflows/gh-pages.yml`
|
|
|
|
An example with Hugo action.
|
|
|
|
- [peaceiris/actions-hugo: GitHub Actions for Hugo extended](https://github.com/peaceiris/actions-hugo)
|
|
|
|

|
|

|
|
|
|
```yaml
|
|
name: github pages
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
|
|
jobs:
|
|
build-deploy:
|
|
runs-on: ubuntu-18.04
|
|
steps:
|
|
- uses: actions/checkout@master
|
|
- name: build
|
|
uses: peaceiris/actions-hugo@v0.57.2
|
|
if: github.event.deleted == false
|
|
with:
|
|
args: --gc --minify --cleanDestinationDir
|
|
- name: deploy
|
|
uses: peaceiris/actions-gh-pages@v1.1.0
|
|
if: success()
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
PUBLISH_BRANCH: gh-pages
|
|
PUBLISH_DIR: ./public
|
|
```
|
|
|
|
|
|
|
|
## Examples
|
|
|
|
### MkDocs
|
|
|
|
- [peaceiris/actions-pipenv: GitHub Actions for pipenv](https://github.com/peaceiris/actions-pipenv)
|
|
- [main.workflow - peaceiris/mkdocs-material-boilerplate](https://github.com/peaceiris/mkdocs-material-boilerplate/blob/master/.github/main.workflow)
|
|
|
|

|
|
|
|
```hcl
|
|
workflow "MkDocs workflow" {
|
|
on = "push"
|
|
resolves = ["deploy"]
|
|
}
|
|
|
|
action "branch-filter" {
|
|
uses = "actions/bin/filter@master"
|
|
args = "branch master"
|
|
}
|
|
|
|
action "pipenv-sync" {
|
|
needs = ["branch-filter"]
|
|
uses = "peaceiris/actions-pipenv@3.6"
|
|
args = "sync"
|
|
}
|
|
|
|
action "mkdocs-build" {
|
|
needs = ["pipenv-sync"]
|
|
uses = "peaceiris/actions-pipenv@3.6"
|
|
args = ["run", "mkdocs", "build", "--config-file", "./mkdocs-sample.yml"]
|
|
}
|
|
|
|
action "deploy" {
|
|
needs = ["mkdocs-build"]
|
|
uses = "peaceiris/actions-gh-pages@v1.1.0"
|
|
env = {
|
|
PUBLISH_DIR = "./site"
|
|
PUBLISH_BRANCH = "gh-pages"
|
|
}
|
|
secrets = ["GITHUB_TOKEN"]
|
|
}
|
|
```
|
|
|
|
|
|
|
|
## License
|
|
|
|
[MIT License - peaceiris/actions-gh-pages]
|
|
|
|
[MIT License - peaceiris/actions-gh-pages]: https://github.com/peaceiris/actions-gh-pages/blob/master/LICENSE
|
|
|
|
|
|
|
|
## About the author
|
|
|
|
- [peaceiris's homepage](https://peaceiris.com/)
|