Skip to content

Commit

Permalink
chore: save GitHub Pages workflow example as page resource
Browse files Browse the repository at this point in the history
  • Loading branch information
razonyang committed May 2, 2024
1 parent 595cef8 commit 50d93b9
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
```yml
name: GitHub Pages
on:
push:
Expand All @@ -7,7 +8,7 @@
contents: write
jobs:
build-and-deploy:
concurrency: ci-${{ printf "{{" }} github.ref {{ printf "}}" }}
concurrency: ci-${{ github.ref }}
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
Expand All @@ -25,9 +26,9 @@
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ printf "{{" }} runner.os {{ printf "}}" }}-node-${{ printf "{{" }} hashFiles('**/package-lock.json') {{ printf "}}" }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ printf "{{" }} runner.os {{ printf "}}" }}-node-
${{ runner.os }}-node-

- name: Install dependencies
run: npm install
Expand All @@ -44,5 +45,6 @@
- name: Deploy 🚀
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ printf "{{" }} secrets.GITHUB_TOKEN {{ printf "}}" }}
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./public
```
4 changes: 1 addition & 3 deletions exampleSite/content/docs/deployment/github-pages/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ This article explains how to deploy sites to [GitHub Pages](https://pages.github

Create `.github/workflows/gh-pages.yml` in the site root.

```yaml
{{% code/deployment-github-pages-workflow %}}
```
{{< page-resource-content "code/workflow" >}}

> See also [Starter Template GitHub Pages Workflow](https://github.com/razonyang/hugo-theme-bootstrap-skeleton/blob/main/.github/workflows/gh-pages.yml)
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ images = []

于根目录创建 Workflow `.github/workflows/gh-pages.yml`

```yaml
{{% code/deployment-github-pages-workflow %}}
```
{{< page-resource-content "code/workflow" >}}

> 也可以参考[新手模板的 GitHub Pages Workflow](https://github.com/razonyang/hugo-theme-bootstrap-skeleton/blob/main/.github/workflows/gh-pages.yml)
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ images = []

於根目錄創建 Workflow `.github/workflows/gh-pages.yml`

```yaml
{{% code/deployment-github-pages-workflow %}}
```
{{< page-resource-content "code/workflow" >}}

> 也可以參考[新手模板的 GitHub Pages Workflow](https://github.com/razonyang/hugo-theme-bootstrap-skeleton/blob/main/.github/workflows/gh-pages.yml)
6 changes: 6 additions & 0 deletions exampleSite/layouts/shortcodes/page-resource-content.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{{- $name := .Get 0 }}
{{- with .Page.Resources.GetMatch $name }}
{{- .Content | $.Page.RenderString }}
{{- else }}
{{- warnf "no such page resource: %s" $name }}
{{- end }}

0 comments on commit 50d93b9

Please sign in to comment.