Github 自動部署 heroku
===
> 結合Line Bot進行部署, Line Bot申請請參考 [這裏](https://hackmd.io/s/SJcocAIAG)
## Heroku設定
> 免費帳號每個月
### 基本設定
1. 註冊帳號
2. 回到主頁面點選New Apps

3. 輸入App name與設定Apps 區域

4. 設定環境變數
> 在Node.js中會以`process.ENV.設定的KEY`變數呈現

5. 部署設定
> 可以使用Github自動pull部署,也可以直接將git remote到heroku

### 自動部署
#### 利用原生Git部署
> 先下載Heroku CLI https://devcenter.heroku.com/articles/heroku-cli
1. 登入帳號,輸入`heroku login`,並依指示輸入email與密碼
2. 建立git版本控制,把目前程式先commit上去
3. 設定remote git repo,並把程式推上去
```shell=
git push heroku "在Setting看到的heroku.git網址"
git push --set-upstream heroku master
```
看到這個樣子就是部署成功了!

4. 將Domain放到Line bot設定中就完成了!
> Domain在Setting中可以看到

> 放到Linebot設定的webhook url就大功告成!可以按Verify看有沒有連接成功

#### 利用Github部署
---
## Reference
- [LineBot入門與部署](http://www.oxxostudio.tw/articles/201701/line-bot.html)
- [heroku 原生git部署](https://ithelp.ithome.com.tw/articles/10189021)
- tip [heroku tips](https://note.pcwu.net/2017/03/18/nodejs-heroku-deployment/)