Deploy the site using gh-pages

This commit is contained in:
jinhojang6 2020-06-11 23:00:13 +09:00
parent f2b7c5dae8
commit 2c4ad94a61
4 changed files with 130 additions and 6 deletions

View File

@ -30,5 +30,16 @@ docker run -p 3000:3000 <image_id>
<br/>
## Deploy
Update `org` and `repot` in `/scripts/deploy.js`.
```
yarn run build
yarn run export
touch out/.nojekyll
yarn run deploy
```
<br/>
## References
- [Documentation](https://pankod.github.io/next-boilerplate/docs/deployment)

View File

@ -16,10 +16,11 @@
"pretty": "prettier --write --config .prettierrc.json {src,pages,server}/**/*.{ts,tsx}",
"format": "npm run lint -- --fix",
"analyze": "cross-env BUNDLE_ANALYZE=both npm run build",
"export": "cross-env NODE_ENV=production next export",
"export": "cross-env NODE_ENV=production next export && mv ./out/home.html ./out/index.html",
"cli": "pankod-cli add",
"storybook": "start-storybook -s ./public/static -p 6006",
"build-storybook": "build-storybook -s ./public/static -c .storybook -o .storybookout"
"build-storybook": "build-storybook -s ./public/static -c .storybook -o .storybookout",
"deploy": "node scripts/deploy.js"
},
"dependencies": {
"@types/react-burger-menu": "^2.6.1",
@ -102,6 +103,7 @@
"eslint-plugin-react": "7.x",
"eslint-plugin-react-hooks": "1.x",
"fork-ts-checker-webpack-plugin": "^4.1.2",
"gh-pages": "^3.0.0",
"jest": "^25.5.3",
"jest-styled-components": "^6.3.4",
"nock": "^11.3.5",

34
scripts/deploy.js Normal file
View File

@ -0,0 +1,34 @@
const { promisify } = require('util')
const { publish } = require('gh-pages')
const ghpublish = promisify(publish)
/* fix for "Unhandled promise rejections" */
process.on('unhandledRejection', err => { throw err })
const branch = 'gh-pages'
const org = 'jinhojang6'
const repo = 'status-tutorials'
/* use SSH auth by default */
const repoUrl = `git@github.com:${org}/${repo}.git`
/* alternative auth using GitHub user and API token */
if (process.env.GH_USER != undefined) {
repoUrl = (
'https://' + process.env.GH_USER +
':' + process.env.GH_TOKEN +
'@' + `github.com/${org}/${repo}.git`
)
}
const main = async (url, branch)=> {
console.log(`Pushing to: ${url}`)
console.log(`On branch: ${branch}`)
await ghpublish('out', {
repo: url,
branch: branch,
dotfiles: true,
silent: false
})
}
main(repoUrl, branch)

View File

@ -3590,7 +3590,7 @@ async-limiter@~1.0.0:
resolved "https://registry.yarnpkg.com/async-limiter/-/async-limiter-1.0.1.tgz#dd379e94f0db8310b08291f9d64c3209766617fd"
integrity sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ==
async@^2.1.5:
async@^2.1.5, async@^2.6.1:
version "2.6.3"
resolved "https://registry.yarnpkg.com/async/-/async-2.6.3.tgz#d72625e2344a3656e3a3ad4fa749fa83299d82ff"
integrity sha512-zflvls11DCy+dQWzTW2dzuilv8Z5X/pjfmZOWba6TNIVDm+2UDaJmXSOXlasHKfNBs8oo3M0aT50fDEWfKZjXg==
@ -4915,7 +4915,7 @@ comma-separated-tokens@^1.0.0:
resolved "https://registry.yarnpkg.com/comma-separated-tokens/-/comma-separated-tokens-1.0.8.tgz#632b80b6117867a158f1080ad498b2fbe7e3f5ea"
integrity sha512-GHuDRO12Sypu2cV70d1dkA2EUmXHgntrzbpvOB+Qy+49ypNfGgFQIC2fhhXbnyrJRynDCAARsT7Ou0M6hirpfw==
commander@^2.11.0, commander@^2.13.0, commander@^2.19.0, commander@^2.20.0:
commander@^2.11.0, commander@^2.13.0, commander@^2.18.0, commander@^2.19.0, commander@^2.20.0:
version "2.20.3"
resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33"
integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==
@ -5930,6 +5930,11 @@ elliptic@^6.0.0, elliptic@^6.5.2:
minimalistic-assert "^1.0.0"
minimalistic-crypto-utils "^1.0.0"
email-addresses@^3.0.1:
version "3.1.0"
resolved "https://registry.yarnpkg.com/email-addresses/-/email-addresses-3.1.0.tgz#cabf7e085cbdb63008a70319a74e6136188812fb"
integrity sha512-k0/r7GrWVL32kZlGwfPNgB2Y/mMXVTq/decgLczm/j34whdaspNrZO8CnXPf1laaHxI6ptUlsnAxN+UAPw+fzg==
emoji-regex@^7.0.1, emoji-regex@^7.0.2:
version "7.0.3"
resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-7.0.3.tgz#933a04052860c85e83c122479c4748a8e4c72156"
@ -6771,6 +6776,28 @@ file-uri-to-path@1.0.0:
resolved "https://registry.yarnpkg.com/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz#553a7b8446ff6f684359c445f1e37a05dacc33dd"
integrity sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==
filename-reserved-regex@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/filename-reserved-regex/-/filename-reserved-regex-1.0.0.tgz#e61cf805f0de1c984567d0386dc5df50ee5af7e4"
integrity sha1-5hz4BfDeHJhFZ9A4bcXfUO5a9+Q=
filenamify-url@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/filenamify-url/-/filenamify-url-1.0.0.tgz#b32bd81319ef5863b73078bed50f46a4f7975f50"
integrity sha1-syvYExnvWGO3MHi+1Q9GpPeXX1A=
dependencies:
filenamify "^1.0.0"
humanize-url "^1.0.0"
filenamify@^1.0.0:
version "1.2.1"
resolved "https://registry.yarnpkg.com/filenamify/-/filenamify-1.2.1.tgz#a9f2ffd11c503bed300015029272378f1f1365a5"
integrity sha1-qfL/0RxQO+0wABUCknI3jx8TZaU=
dependencies:
filename-reserved-regex "^1.0.0"
strip-outer "^1.0.0"
trim-repeated "^1.0.0"
filesize@3.6.1, filesize@^3.5.11:
version "3.6.1"
resolved "https://registry.yarnpkg.com/filesize/-/filesize-3.6.1.tgz#090bb3ee01b6f801a8a8be99d31710b3422bb317"
@ -7030,7 +7057,7 @@ fs-extra@^7.0.0:
jsonfile "^4.0.0"
universalify "^0.1.0"
fs-extra@^8.0.1:
fs-extra@^8.0.1, fs-extra@^8.1.0:
version "8.1.0"
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-8.1.0.tgz#49d43c45a88cd9677668cb7be1b46efdb8d2e1c0"
integrity sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==
@ -7185,6 +7212,18 @@ getpass@^0.1.1:
dependencies:
assert-plus "^1.0.0"
gh-pages@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/gh-pages/-/gh-pages-3.0.0.tgz#65f3ccd424bfbc7906f31c4bdb524a1147fa8da2"
integrity sha512-oaOfVcrSwnqoWUgZ6cmCDM6mUuWyOSG+SHjqxGBawN0F3SKaF5NwbeYDG+w2RNXO2HJ/5Iam4o7dP5NAtoHuwQ==
dependencies:
async "^2.6.1"
commander "^2.18.0"
email-addresses "^3.0.1"
filenamify-url "^1.0.0"
fs-extra "^8.1.0"
globby "^6.1.0"
glob-base@^0.3.0:
version "0.3.0"
resolved "https://registry.yarnpkg.com/glob-base/-/glob-base-0.3.0.tgz#dbb164f6221b1c0b1ccf82aea328b497df0ea3c4"
@ -7305,6 +7344,17 @@ globby@8.0.2:
pify "^3.0.0"
slash "^1.0.0"
globby@^6.1.0:
version "6.1.0"
resolved "https://registry.yarnpkg.com/globby/-/globby-6.1.0.tgz#f5a6d70e8395e21c858fb0489d64df02424d506c"
integrity sha1-9abXDoOV4hyFj7BInWTfAkJNUGw=
dependencies:
array-union "^1.0.1"
glob "^7.0.3"
object-assign "^4.0.1"
pify "^2.0.0"
pinkie-promise "^2.0.0"
globrex@^0.1.1:
version "0.1.2"
resolved "https://registry.yarnpkg.com/globrex/-/globrex-0.1.2.tgz#dd5d9ec826232730cd6793a5e33a9302985e6098"
@ -7714,6 +7764,14 @@ human-signals@^1.1.1:
resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-1.1.1.tgz#c5b1cd14f50aeae09ab6c59fe63ba3395fe4dfa3"
integrity sha512-SEQu7vl8KjNL2eoGBLF3+wAjpsNfA9XMlXAYj/3EdaNfAlxKthD1xjEQfGOUhllCGGJVNY34bRr6lPINhNjyZw==
humanize-url@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/humanize-url/-/humanize-url-1.0.1.tgz#f4ab99e0d288174ca4e1e50407c55fbae464efff"
integrity sha1-9KuZ4NKIF0yk4eUEB8VfuuRk7/8=
dependencies:
normalize-url "^1.0.0"
strip-url-auth "^1.0.0"
hyperlinker@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/hyperlinker/-/hyperlinker-1.0.0.tgz#23dc9e38a206b208ee49bc2d6c8ef47027df0c0e"
@ -10178,7 +10236,7 @@ normalize-range@^0.1.2:
resolved "https://registry.yarnpkg.com/normalize-range/-/normalize-range-0.1.2.tgz#2d10c06bdfd312ea9777695a4d28439456b75942"
integrity sha1-LRDAa9/TEuqXd2laTShDlFa3WUI=
normalize-url@1.9.1:
normalize-url@1.9.1, normalize-url@^1.0.0:
version "1.9.1"
resolved "https://registry.yarnpkg.com/normalize-url/-/normalize-url-1.9.1.tgz#2cc0d66b31ea23036458436e3620d85954c66c3c"
integrity sha1-LMDWazHqIwNkWENuNiDYWVTGbDw=
@ -13350,6 +13408,18 @@ strip-json-comments@~2.0.1:
resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a"
integrity sha1-PFMZQukIwml8DsNEhYwobHygpgo=
strip-outer@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/strip-outer/-/strip-outer-1.0.1.tgz#b2fd2abf6604b9d1e6013057195df836b8a9d631"
integrity sha512-k55yxKHwaXnpYGsOzg4Vl8+tDrWylxDEpknGjhTiZB8dFRU5rTo9CAzeycivxV3s+zlTKwrs6WxMxR95n26kwg==
dependencies:
escape-string-regexp "^1.0.2"
strip-url-auth@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/strip-url-auth/-/strip-url-auth-1.0.1.tgz#22b0fa3a41385b33be3f331551bbb837fa0cd7ae"
integrity sha1-IrD6OkE4WzO+PzMVUbu4N/oM164=
style-loader@1.2.1, style-loader@^1.0.0, style-loader@^1.1.3:
version "1.2.1"
resolved "https://registry.yarnpkg.com/style-loader/-/style-loader-1.2.1.tgz#c5cbbfbf1170d076cfdd86e0109c5bba114baa1a"
@ -13775,6 +13845,13 @@ trim-newlines@^1.0.0:
resolved "https://registry.yarnpkg.com/trim-newlines/-/trim-newlines-1.0.0.tgz#5887966bb582a4503a41eb524f7d35011815a613"
integrity sha1-WIeWa7WCpFA6QetST301ARgVphM=
trim-repeated@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/trim-repeated/-/trim-repeated-1.0.0.tgz#e3646a2ea4e891312bf7eace6cfb05380bc01c21"
integrity sha1-42RqLqTokTEr9+rObPsFOAvAHCE=
dependencies:
escape-string-regexp "^1.0.2"
"true-case-path@^1.0.2":
version "1.0.3"
resolved "https://registry.yarnpkg.com/true-case-path/-/true-case-path-1.0.3.tgz#f813b5a8c86b40da59606722b144e3225799f47d"