Angular: deploy build and publish in github
Method1:
push an existing repository from the command line
git remote add origin https://github.com/pradeepakv/fashioHtoA.git
git branch -M master
git push -u origin master
Steps to deploy build and publish gh pages for any Angular projects:
In the angular.json file, change the outputpath value to “docs/”
ng build --prod --baseHref="https://username.github.io/respository-name/"
Code Commit
git add .
git commit -m "generated deployables"
git push -u origin master
Configure Your GitHub Repository for Publishing on GitHub Pages
Once the docs folder is pushed into your GitHub repository, you need to open the repository settings and go to the GitHub Pages section and select “master branch/docs folder” from the source dropdown. And that’s it!
— — — — — — — — — — — — — — — — — — — — — — — — — — — — —
Method2:
Add in package.json:
"homepage": "https://accountName.github.io/repositoryName"
Open Git bash and execute following commands:
1.npm i angular-cli-ghpages --save-dev
ng add angular-cli-ghpages2. ng build --prod--baseHref="https://pradeepakv.github.io/fashionHtoA"3.ng build --prod --output-path docs —-base-href /<project_name>/ng build --prod —-output-path project —-base-href "https://pradeepakv.github.io/fashionHtoA"4.ng build
5. ngh —-dir=dist/fashionHtoA
Now in github, settings-> GitHub Pages ->generate url
change source to ghpages
You Are Done :) Happy to go….
— — — — — — — — — — — — — — — — — — — — — — — — — — — — — —