[SalesForce] ERROR running force:source:deploy: This command is required to run from within an SFDX project

I am trying to use GitHub actions to deploy code to my developer org. While running the workflow i am getting error like. I am unable to figure where it is wrong

enter image description here

Below is the structure in github.

enter image description here
enter image description here

sfdx-project.json file

{
  "packageDirectories": [
    {
      "path": "force-app",
      "default": true
    }
  ],
  "namespace": "",
  "sfdcLoginUrl": "https://login.salesforce.com",
  "sourceApiVersion": "48.0"
}

i am using below github workflow file

#..github/workflows/main.yml
name: githubactioncicd
on: 
  # Trigger the workflow on push or pull request,
  # but only for the main branch
  push:
    branches:
      - main
  pull_request:
    branches:
      - main
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@main
      if: github.event.action == 'opened' || github.event.action == 'synchronize'
    - uses: actions/setup-node@v1
      with:
        node-version: '10.x'

    - name: Install Salesforce CLI
      run: |
        npm install sfdx-cli
        node_modules/sfdx-cli/bin/run --version
        node_modules/sfdx-cli/bin/run plugins --core
      
    - name: Authenticate DevHub
      run: |
        echo "${SALESFORCE_JWT_SECRET_KEY}" > server.key
        node_modules/sfdx-cli/bin/run force:auth:jwt:grant --clientid ${{ secrets.SALESFORCE_CONSUMER_KEY }} --jwtkeyfile server.key --username ${{ secrets.SALESFORCE_DEVHUB_USERNAME}} --instanceurl https://login.salesforce.com --setdefaultdevhubusername
      env:
        SALESFORCE_JWT_SECRET_KEY: ${{ secrets.SALESFORCE_JWT_SECRET_KEY }}
    - name: Deploy source
      run: node_modules/sfdx-cli/bin/run force:source:deploy --manifest manifest/package.xml

enter image description here

Best Answer

You are using the wrong parameter. You have to use [-x MANIFEST] instead of [-p SOURCEPATH] working with package.xml :enter image description here as explain in the documentation (https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_reference.meta/sfdx_cli_reference/cli_reference_force_source.htm)

Related Topic