mirror of
https://github.com/peaceiris/actions-gh-pages.git
synced 2025-07-15 06:33: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
|
## 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.
|
|||||||

|

|
||||||

|

|
||||||
|
|
||||||
```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 |
|
||||||
|
Loading…
x
Reference in New Issue
Block a user