-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
105 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,92 @@ | ||
name: github pages | ||
name: Deploy Hugo site to Pages | ||
|
||
on: | ||
# Runs on pushes targeting the default branch | ||
push: | ||
branches: | ||
- main | ||
branches: ["main"] | ||
|
||
# versions should be kept in sync with lighthouse-ci workflow | ||
env: | ||
HUGO_VERSION: 0.119.0 # if you update this, change the README badge and lighthouse-ci.yml too! | ||
NODE_VERSION: 18 # if you update this, change the README badge and lighthouse-ci.yml too! | ||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | ||
permissions: | ||
contents: read | ||
pages: write | ||
id-token: write | ||
|
||
# Allow one concurrent deployment | ||
concurrency: | ||
group: "pages" | ||
cancel-in-progress: true | ||
|
||
# Default to bash | ||
defaults: | ||
run: | ||
shell: bash | ||
|
||
jobs: | ||
build-deploy: | ||
name: build site and deploy to github pages | ||
# Build job | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Get Hugo version | ||
run: echo "HUGO_VERSION=$(cat .hugo_version)" >> $GITHUB_ENV | ||
|
||
- name: setup hugo | ||
uses: peaceiris/actions-hugo@v2 | ||
with: | ||
hugo-version: ${{ env.HUGO_VERSION }} | ||
extended: true | ||
|
||
- name: Get node version from package.json | ||
run: echo "NODE_VERSION=$(cat package.json | jq -r '.volta.node')" >> $GITHUB_ENV | ||
|
||
- name: setup node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ env.NODE_VERSION }} | ||
|
||
- name: fetch js dependencies from cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.npm | ||
key: npm-${{ hashFiles('package-lock.json') }} | ||
restore-keys: | | ||
npm-${{ hashFiles('package-lock.json') }} | ||
npm- | ||
- name: install js dependencies | ||
run: npm ci | ||
|
||
- name: Setup Pages | ||
id: pages | ||
uses: actions/configure-pages@v3 | ||
|
||
- name: Build with Hugo | ||
env: | ||
# For maximum backward compatibility with Hugo modules | ||
HUGO_ENVIRONMENT: production | ||
HUGO_ENV: production | ||
run: | | ||
hugo \ | ||
--minify \ | ||
--baseURL ${{ steps.pages.outputs.base_url }} | ||
- name: Upload artifact | ||
uses: actions/upload-pages-artifact@v2 | ||
with: | ||
path: ./public | ||
|
||
# Deployment job | ||
deploy: | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
runs-on: ubuntu-latest | ||
needs: build | ||
steps: | ||
- name: checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: setup hugo | ||
uses: peaceiris/actions-hugo@v2 | ||
with: | ||
hugo-version: ${{ env.HUGO_VERSION }} | ||
extended: true | ||
|
||
- name: setup node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ env.NODE_VERSION }} | ||
|
||
- name: fetch js dependencies from cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.npm | ||
key: npm-${{ hashFiles('package-lock.json') }} | ||
restore-keys: | | ||
npm-${{ hashFiles('package-lock.json') }} | ||
npm- | ||
- name: install js dependencies | ||
run: npm ci | ||
|
||
- name: build site | ||
run: hugo --minify | ||
|
||
- name: deploy site to github pages | ||
uses: peaceiris/actions-gh-pages@v3 | ||
with: | ||
deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }} | ||
publish_dir: ./public | ||
- name: Deploy to GitHub Pages | ||
id: deployment | ||
uses: actions/deploy-pages@v2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
0.119.0 |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters