From 6492b522cec8813590f3f31094b75c43725adccf Mon Sep 17 00:00:00 2001 From: peaceiris <30958501+peaceiris@users.noreply.github.com> Date: Thu, 22 Aug 2019 02:48:35 +0900 Subject: [PATCH] migrate: GitHub Actions v2 YAML workflow setting example with hugo --- README.md | 54 ++++++++++++++++++++++++------------------------------ 1 file changed, 24 insertions(+), 30 deletions(-) diff --git a/README.md b/README.md index 823eef3..0cef6f6 100644 --- a/README.md +++ b/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. ![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) -```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 |