Create github CI/CD pipeline/github action for salesforce deployment / How to Use GitHub with VS Code and Deploy with a Connected App in salesforce

How to Use GitHub with VS Code and Deploy with a Connected App


1. Create a GitHub Account or Sign In

  •     1. Go to GitHub.
  •     2. Sign Up: If you don’t have an account, click on “Sign up” and follow the prompts to create        a new account.
  •    3. Sign In: If you already have an account, click on “Sign in” and enter your credentials.


2. Create a Repository

  2.1. On GitHub’s homepage, click the + icon in the top-right corner and select  "New repository".

  2.2. Fill in Repository Details:

   - Repository Name : Choose a name for your repository.

   - Description: Add a brief description of your repository.

   - Public/Private: Choose whether you want your repository to be public or private.

  2.3. Click “Create repository”.


3. Pull Your GitHub Repo in VS Code and Push Your Code

  3.1. Open VS Code.

  3.2. Open the Terminal: You can do this by navigating to Terminal > New Terminal from the top menu.

  3.3. Add the Remote Repository:

   - Run the following command, replacing `"your-repository-url"` with the URL of your GitHub repository:

     git remote add origin "your-repository-url"

4. Pull the Repository: To pull the latest changes from your GitHub repository:

   git pull origin main


5. Activate Version Control:

   - If not already initialized, you can run `git init` to initialize a new Git repository.

   - Add files to version control with:

     git add .

6. Commit Changes:

   git commit -m "Your commit message"


7. Push Changes to GitHub:

   git push origin main



8. Create a Connected App in Target Org for Deployment

1. Visit the Connected App Creation URL (provided in your organization’s documentation or Salesforce setup).

 To create Connected App in salesforce , visit this link : Connected App Creation


9. Store Sensitive Information Securely

  1. Go to Repository Settings:

    • Click on the “Settings” tab in your repository.
    • Navigate to the “Secrets and variables” section on the left menu.
  2. Store Your Secrets:

    • Client ID: Add your client ID.
    • Client Secret: Add your client secret key.
    • Username: Add your username.

    Note: Avoid exposing sensitive information directly in your YAML files. Use GitHub Secrets for secure storage and management of sensitive data.

10. Click on "Action".

  

4. Click "Setup a Workflow Yourself":

  

   - Create a new YAML file by following the instructions provided. This will define the deployment workflow for your connected app.

5. Add YAML Content: Enter the appropriate YAML configuration for your deployment.


Note : I'll  update  & add YML file on 12-08-2024. Thanks

👍 Like this guide if it works for you!

💬 Comment below if you need any help or have questions.


Comments

Popular posts from this blog

Salesforce Developer most asked interview Questions

Lightning web Component interview Questions 2024[Freshers & Experienced till 3-5years of experience]