Create Feature Branches & Workflow Updates
This document outlines the steps for creating feature branches and updating GitHub workflows for streamlined deployment.
Pre-requisites
- Confirm the Base Branch: Ensure that you know the correct base branch from which the feature branches will be created. Typically, this is the
develop
branch. - Confirm the Fix Version Name: Determine the fix version name you will be using for the branches and updates. This should be consistent across all steps.
Feature Branch
Naming Conventions
- Feature branch format should be like
feature-<fix-version-name>
. - For a full-fledged feature, use chocolate names. For example: feature-mentos, feature-galaxy.
- For a hot fix, use an Indian sweet name. For example: feature-boondhi, feature-imarti.
Note: *feature-** is a protected branch.
- Two approvals are required to merge.
- Only Vishwa or Vikram can merge to the *feature-* branch.
Steps to Create the Feature Branch
- Navigate to your repository on GitHub at DigitalInnk.
- On the main page of your repository, access the dropdown menu next to the branch selection.
- Choose the base branch if it's not already selected.
- Once the base branch is selected, click the branch dropdown menu again.
- Enter the name of your new branch (e.g.,
feature-mentos
), then click "Create branch" or press Enter. This action will generate the new feature branch from the base branch.
Sprint Branch
A sprint branch is used as the base branch for a given sprint. All commits will be pushed to this sprint branch.
- Sprint branch format should be like
<sprint>-feature-<fix-version-name>
. For example: sprint98-feature-mentos. - A new branch will be created at the beginning of each sprint.
- sprint98-feature-* is a protected branch. You can only merge after two approvals.
- This branch is created from its respective feature branch, in this case, feature-mentos.
Steps to Create the Sprint Branch
- Switch to the
feature-<fix-version-name>
branch by selecting it from the branch dropdown menu. - After selecting the
feature-<fix-version-name>
branch, access the branch dropdown menu again. - Input the name of your new branch (e.g.,
sprint97-feature-mentos
), then click "Create branch" or press Enter. This process will create the new sprint feature branch from thefeature-<fix-version-name>
branch.
To Create a Callable Service, Follow These Steps
- Ensure that you have created fix version branches for the callable repository.
- Go to the "Actions" tab in the repository.
- Select the “.DEV - Deploy service for sprint branch” workflow.
- In the "Run workflow" dropdown menu, select the newly created branch
<sprint>-feature-<new fix version>
from the available branches, and manually run the workflow. - Once the workflow execution is completed, open the workflow that you just ran.
- Inside the workflow run, look for the section related to the deployment of the callable service. Verify that the service name corresponds to the newly created callable service associated with the fix version branch
<sprint>-feature-<new fix version>
. - Ensure that the service name is correctly listed and deployed in the Cloud Run Console.
Steps to Update GitHub Host Workflow for Web
- Open VS Code and switch to the
<sprint>-feature-<fix-version-name>
branch. - Open the
.firebaserc
file.- Find the
"targets"
section within the JSON structure. - Remove the
<old fix version name>-devvisn
target and its associated array. - Add the
<new fix version name>-devvisn
target and its associated array.
- Find the
- Open the
firebase.json
file.- Locate the section that defines the
<old Fix Version>-devvisn
target. - Replace the entire
<old Fix Version>-devvisn
target section with the updated<new fix version>-devvisn
target. - Update the
ServiceId
associated with the callable service.
- Locate the section that defines the
- Open the
on_merge-sprint-feature_deploy_to_dev.yml
file.- Locate the section where the branches are specified under the
on
key. - Update the branch name from
sprint[0-9][0-9]-feature-<old Fix Version>
tosprint[0-9][0-9]-feature-<new Fix Version>
. - Locate the section where the Firebase hosting targets are set.
- Update the Firebase hosting targets from
<old Fix Version>-devvisn
to<new Fix Version>-devvisn
.
- Locate the section where the branches are specified under the
Steps to Update GitHub Host Workflow for Admin
- Open VS Code and switch to the
<sprint>-feature-<fix-version-name>
branch. - Open the
.firebaserc
file.- Find the
"targets"
section within the JSON structure. - Remove the
<old fix version name>-devadmin
target and its associated array. - Add the
<new fix version name>-devadmin
target and its associated array.
- Find the
- Open the
firebase.json
file.- Locate the section that defines the
<old Fix Version>-devadmin
target. - Replace the entire
<old Fix Version>-devadmin
target section with the updated<new fix version>-devadmin
target. - Update the
ServiceId
associated with the callable service.
- Locate the section that defines the
- Open the
on_merge-sprint-feature_deploy_to_dev.yml
file.- Locate the section where the branches are specified under the
on
key. - Update the branch name from
sprint[0-9][0-9]-feature-<old Fix Version>
tosprint[0-9][0-9]-feature-<new Fix Version>
. - Locate the section where the Firebase hosting targets are set.
- Update the Firebase hosting targets from
<old Fix Version>-devadmin
to<new Fix Version>-devadmin
.
- Locate the section where the branches are specified under the
Verify Workflow and Hosting
- After merging the PR, check GitHub Actions to ensure the merge workflow completes successfully.
- In Firebase Console, verify the new hosting site is working.
note
Workflow updates are only necessary for the Web and Admin repositories. For other repositories, just creating the feature and sprint branches is sufficient.
Status: Accepted
Category: Protected
Authored By: Jeyakumar Arunagiri on May 24, 2024
Revisions.