Skip to content

Commit

Permalink
Add workflow actions for GitHub pages
Browse files Browse the repository at this point in the history
  • Loading branch information
travismiller committed Feb 1, 2021
1 parent 536423c commit 297f127
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 1 deletion.
40 changes: 40 additions & 0 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: GitHub Pages

# https://github.com/peaceiris/actions-gh-pages#%EF%B8%8F-react-and-next

on:
push:
branches:
- main

jobs:
deploy:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2

- name: Setup Node
uses: actions/[email protected]
with:
node-version: "12.x"

- name: Get yarn cache
id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"

- name: Cache dependencies
uses: actions/cache@v2
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- run: yarn install --frozen-lockfile
- run: BASE_PATH=${{ secrets.BASE_PATH }} yarn build

- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./out
6 changes: 6 additions & 0 deletions next.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// https://nextjs.org/docs/api-reference/next.config.js/introduction

module.exports = {
// https://nextjs.org/docs/api-reference/next.config.js/basepath
basePath: process.env.BASE_PATH || '',
}
2 changes: 1 addition & 1 deletion pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default function Home() {
<div className={styles.container}>
<Head>
<title>Create Next App</title>
<link rel="icon" href="/favicon.ico" />
<link rel="icon" href={`${process.env.BASE_PATH || ''}/favicon.ico`} />
</Head>

<main className={styles.main}>
Expand Down
2 changes: 2 additions & 0 deletions public/robots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
User-agent: *
Disallow: /

0 comments on commit 297f127

Please sign in to comment.