This repository has been archived by the owner on Jan 22, 2024. It is now read-only.
forked from doubtfire-lms/doubtfire.io
-
Notifications
You must be signed in to change notification settings - Fork 0
68 lines (57 loc) · 1.59 KB
/
pages.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
name: Publish to GitHub Pages
on:
# Run when `pages` is committed to.
push:
branches: [pages]
# Allow manual invocation.
workflow_dispatch:
jobs:
pages:
# The type of runner that the job will run on.
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job.
steps:
# Setup Node.js.
- name: Setup Node.js
uses: actions/[email protected]
with:
node-version: '14.x'
# Checkout `pages`.
- name: Checkout pages
uses: actions/checkout@v2
with:
ref: pages
path: pages
# Checkout `gh-pages`.
- name: Checkout gh-pages
uses: actions/checkout@v2
with:
ref: gh-pages
path: gh-pages
# Build & export Next.js static website.
- name: Build & export
run: |
cd pages
npm install
npm run build
npm run export
git rev-parse HEAD > ../hash
# Commit to gh-pages.
- name: Commit gh-pages
run: |
cd gh-pages
rm -rf *
mv ../pages/out/** .
touch .nojekyll
echo 'doubtfire.io' >CNAME
git add .
git config --local user.email "[email protected]"
git config --local user.name "GitHub Actions"
git commit -m "Publish $(cat ../hash)"
# Push
- name: Push gh-pages
uses: ad-m/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: gh-pages
directory: gh-pages