diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml new file mode 100644 index 0000000..f15ac48 --- /dev/null +++ b/.github/workflows/gh-pages.yml @@ -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/setup-node@v2.1.2 + 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 diff --git a/next.config.js b/next.config.js new file mode 100644 index 0000000..a79aae9 --- /dev/null +++ b/next.config.js @@ -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 || '', +} diff --git a/pages/index.js b/pages/index.js index 5787b11..810709c 100644 --- a/pages/index.js +++ b/pages/index.js @@ -6,7 +6,7 @@ export default function Home() {