mirror of
https://github.com/peaceiris/actions-gh-pages.git
synced 2025-07-14 22:29:17 +08:00
migrate: GitHub Actions v2 YAML workflow setting example with hugo
This commit is contained in:
parent
5b4ace2ae6
commit
6492b522ce
54
README.md
54
README.md
@ -16,7 +16,7 @@ A GitHub Action to deploy your static site to GitHub Pages with [Static Site Gen
|
||||
|
||||
## Getting started
|
||||
|
||||
### Create `.github/main.workflow`
|
||||
### Create `.github/workflows/gh-pages.yml`
|
||||
|
||||
An example with Hugo action.
|
||||
|
||||
@ -25,37 +25,31 @@ An example with Hugo action.
|
||||

|
||||

|
||||
|
||||
```hcl
|
||||
workflow "GitHub Pages" {
|
||||
on = "push"
|
||||
resolves = ["deploy"]
|
||||
}
|
||||
```yaml
|
||||
name: github-pages
|
||||
|
||||
action "is-branch-master" {
|
||||
uses = "actions/bin/filter@master"
|
||||
args = "branch master"
|
||||
}
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
action "is-not-branch-deleted" {
|
||||
uses = "actions/bin/filter@master"
|
||||
args = "not deleted"
|
||||
}
|
||||
|
||||
action "build" {
|
||||
needs = ["is-branch-master", "is-not-branch-deleted"]
|
||||
uses = "peaceiris/actions-hugo@v0.56.3"
|
||||
args = ["--gc", "--minify", "--cleanDestinationDir"]
|
||||
}
|
||||
|
||||
action "deploy" {
|
||||
needs = "build"
|
||||
uses = "peaceiris/actions-gh-pages@v1.1.0"
|
||||
env = {
|
||||
PUBLISH_DIR = "./public"
|
||||
PUBLISH_BRANCH = "gh-pages"
|
||||
}
|
||||
secrets = ["GITHUB_TOKEN"]
|
||||
}
|
||||
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
|
||||
```
|
||||
|
||||
| Workflow overview | Actions log |
|
||||
|
Loading…
x
Reference in New Issue
Block a user