This is just a basic app that only contains relevant files to set up this type of deployment - not much else.
OPTION 3
- PROs
- automated deployments CI/CD
- using a single github repo
- CONs
- the code is public when using GitHub free
- more involving setup, creating an additional branch, adding github actions, GH_TOKEN
- create a git repo, create a local folder for the repo, init (github commands)
- create a your Angular (v17) app & push to
main
branch
- add the build script command in
package.json
"build:prod": "ng build --configuration=production --base-href=/<repoName>/"
- adjust
oututPath
inangular.json
(dist)
- setup a personal acces token GH_TOKEN to use later (classic)
- create a
main.yaml
file in.github/workflows/main.yaml
at root level - refer to this project for placement and contents (adjust to match your project)
*using prebuilt github actions by James Ives github-pages-deploy-action
- create a new branch only for the contents of the
dist
folder - erase everything apart fom the
dist
folder from that second branch and push the changes (I named my branch 'prod') - verify that your 'main' branch contains your entire app, while the second branch only has the contents of the
dist
folder
- go back to the 'main' branch and push -> this should trigger the workflow from the
main.yaml
file
- setup github pages to use the second branch, the one that has only the contents of the
dist
folder