10. Project Restructure - bohdanabadi/doroha-simulator GitHub Wiki
Project Restucture
Now that we have added a new module to be part of our project we need to perform a restructure. Previously we had api as the only part of our repo project. But our project will contain multiple modules having various responsibilities. As a result, we need to move our .git directory from api to parent directory traffic-simulation that will hold and track different modules and will all fall under 1 repository on github as well.
Moving Git
Let's create a new directory on our local machine traffic-simulation and copy our api and fe module inside of it. In addition, moving our .git directory inside api to the parent traffic-simulation. That way any changes inside api or fe will be tracked and we can push our code under 1 repository.
Adding Fe to Git
Now that we have our .git directory at the root project. Let's git add fe and add our frontend directory, then commit and push. Once we push our directory will look something like this
Modifying Api Service Github Actions
Now that we restructured our repository we need to make a minor modification to make sure our github action is only triggered to a specific module. Meaning when we make changes to api module our github action will trigger exclusively to this module rather to fe module changes.
The first change is the on trigger we need to add a path, to ensure the trigger to which module
on:
push:
branches:
- main
paths:
- 'api/**'
And lastly the Build and Deploy part we need to working-directory as follows :
- name: Build and Deploy
#....Previous Configuration
working-directory: ./api