43
Angular app in Github pages
How to deploy and angular app to GitHub pages and get it running under your own domain: username.github.io. Also you can use the GitHub API to get access to your repositories data as I did on my personal portfolio:
Create a new public repository using your GitHub username and this form:
username.github.io

First, clone the newly created repository to a local folder:
$ git clone https://github.com/username/username.github.io.git
Navigate to the repository root folder:
$ cd username.github.io
Create a new angular project in the root directory of the repo:
$ ng new myApp --directory ./
Open angular.json file and change the buildOutput path to “docs”:
angular.json
…
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "docs",
…
Build the angular application in production mode:
$ ng build --prod
You can push the /docs folder only, or you can push the whole application /myApp (recommended):
$ git add .
$ git commit -m "Init app"
$ git push
Then you can view the deployments at the right side of the repository, under environments, pressing github-pages or at https://github.com/username/username.github.io/deployments

43