2

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

4
  • Is there a project file (sfdx-project.json) in the root path? Sorry but maybe you can show or tell the files after the .gitignore. Commented Jan 16, 2021 at 18:01
  • Hi Jeferson..I have added the screesnshot.. Commented Jan 16, 2021 at 18:05
  • No such file ..do you have a package xml file ?? inside manifest folder ..@learnjqueery try running this from another terminal maybe cli or powershell or bash Commented Jan 17, 2021 at 12:26
  • package.xml file is there.. if i run it in vscode terminal.. it is giving.. === Deployed Source No results found.. and the changes are not deployed// Commented Jan 17, 2021 at 12:40

2 Answers 2

2

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)

6
  • Hi Badbaxx.. after updating it .. i am getting the following error.. --> Run node_modules/sfdx-cli/bin/run force:source:deploy --manifest manifest/package.xml /home/runner/work/_temp/80c3953c-2ccb-49cf-94a8-35ff9066dc89.sh: line 1: node_modules/sfdx-cli/bin/run: No such file or directory Error: Process completed with exit code 127. Commented Jan 17, 2021 at 11:22
  • Try to add sfdx in your deploy command (run: node_modules/sfdx-cli/bin/run sfdx force:source:deploy [...]
    – Badbaxx
    Commented Jan 17, 2021 at 11:56
  • Same error --> Run node_modules/sfdx-cli/bin/run sfdx force:source:deploy --manifest /manifest/package.xml /home/runner/work/_temp/4e38dc02-6fca-4ceb-b1a8-4fd9eabc0629.sh: line 1: node_modules/sfdx-cli/bin/run: No such file or directory Error: Process completed with exit code 127. Commented Jan 17, 2021 at 11:59
  • remove the / before manifest in your path to manifest to get node_modules/sfdx-cli/bin/run force:source:deploy --manifest manifest/package.xml
    – Badbaxx
    Commented Jan 17, 2021 at 12:15
  • same error.. i have added the screen shot..removed sfdx command also.. but facing same error.. Commented Jan 17, 2021 at 12:21
0

The command you are using is this

$ sfdx force:source:deploy -p path/to/source

but when you are specifying a manifest you gotta use this

$ sfdx force:source:deploy -x path/to/package.xml

And next time whenever in a fix like this simply do

$ sfdx force:source:deploy --help

(any command without parameter and --help)

this is similar to the man pages of linux it will give all details regarding the commands as well as associated parameters

4
  • I tried the following commands but it is still failing. <----Code Line used ---> $ sfdx force:source:deploy -x force-app/main/default/ ----- > Error message : on Pipeline ERROR running force:source:deploy: This command is required to run from within an SFDX project. Cleaning up project directory and file based variables 00:01 ERROR: Job failed: command terminated with exit code 1 Commented Jun 29, 2023 at 13:24
  • its not recognising your project as a SFDX one this happens sometimes, try updating sfdx or creating a new project sadly Commented Jun 29, 2023 at 16:25
  • Thanks, when you say new project are you referring to the GitLab project or sfdc? Commented Jul 3, 2023 at 15:27
  • sfdx project ... Commented Jul 4, 2023 at 6:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .