migrate: GitHub Actions v2 YAML workflow setting example with hugo

This commit is contained in:
peaceiris 2019-08-22 02:48:35 +09:00
parent 5b4ace2ae6
commit 6492b522ce

View File

@ -16,7 +16,7 @@ A GitHub Action to deploy your static site to GitHub Pages with [Static Site Gen
## Getting started ## Getting started
### Create `.github/main.workflow` ### Create `.github/workflows/gh-pages.yml`
An example with Hugo action. An example with Hugo action.
@ -25,37 +25,31 @@ An example with Hugo action.
![peaceiris/actions-hugo latest version](https://img.shields.io/github/release/peaceiris/actions-hugo.svg?label=peaceiris%2Factions-hugo) ![peaceiris/actions-hugo latest version](https://img.shields.io/github/release/peaceiris/actions-hugo.svg?label=peaceiris%2Factions-hugo)
![peaceiris/actions-gh-pages latest version](https://img.shields.io/github/release/peaceiris/actions-gh-pages.svg?label=peaceiris%2Factions-gh-pages) ![peaceiris/actions-gh-pages latest version](https://img.shields.io/github/release/peaceiris/actions-gh-pages.svg?label=peaceiris%2Factions-gh-pages)
```hcl ```yaml
workflow "GitHub Pages" { name: github-pages
on = "push"
resolves = ["deploy"]
}
action "is-branch-master" { on:
uses = "actions/bin/filter@master" push:
args = "branch master" branches:
} - master
action "is-not-branch-deleted" { jobs:
uses = "actions/bin/filter@master" build-deploy:
args = "not deleted" runs-on: ubuntu-18.04
} steps:
- uses: actions/checkout@master
action "build" { - name: build
needs = ["is-branch-master", "is-not-branch-deleted"] uses: peaceiris/actions-hugo@v0.57.2
uses = "peaceiris/actions-hugo@v0.56.3" if: github.event.deleted == false
args = ["--gc", "--minify", "--cleanDestinationDir"] with:
} args: --gc --minify --cleanDestinationDir
- name: deploy
action "deploy" { uses: peaceiris/actions-gh-pages@v1.1.0
needs = "build" if: success()
uses = "peaceiris/actions-gh-pages@v1.1.0" env:
env = { GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PUBLISH_DIR = "./public" PUBLISH_BRANCH: gh-pages
PUBLISH_BRANCH = "gh-pages" PUBLISH_DIR: ./public
}
secrets = ["GITHUB_TOKEN"]
}
``` ```
| Workflow overview | Actions log | | Workflow overview | Actions log |