'How to resolve gulp publish error while deploying ci/cd with github action

I am trying to deploy the ci/cd pipeline for ECR in AWS.

We are trying to migrate the azure pipeline to the GitHub actions pipeline

When I try to implement the pipeline I am facing the below error,

Run gulp publish --profile-name development
Using gulpfile ~/work/test-api/test-api/gulpfile.js
Starting 'publish'...
'publish' errored after 9.91 ms
Error: Invalid publish profile named development
    at LoadPublishProfile (/home/runner/work/test-api/test-api/node_modules/@pinzgolf/pinz-build/dist/publish/LoadPublishProfile.js:11:15)
    at async BuildDeployContext (/home/runner/work/test-api/test-api/node_modules/@pinzgolf/pinz-build/dist/publish/DeployContext.js:94:28)
    at async Publish (/home/runner/work/test-api/test-api/node_modules/@pinzgolf/pinz-build/dist/publish/Publish.js:14:21)
Error: Process completed with exit code 1.

Here is my workflow YAML file,

on:
  push:
    branches: [ main ]

name: Node Project `my-app` CI on ECRjobs
jobs:
  deploy:
    name: Deploy
    runs-on: ubuntu-latest
    
    steps:
    - uses: actions/checkout@v2
    - name: Use Node 14.17.X
      uses: actions/setup-node@v2
      with:
        node-version: 14.17.X     
    
    - name: 'Yarn'
      uses: borales/[email protected]
      with:
        cmd: install --frozen-lockfile --non-interactive
    
    - name: Update SAM version
      uses: aws-actions/setup-sam@v1
    - run: |
        wget https://github.com/aws/aws-sam-cli/releases/latest/download/aws-sam-cli-linux-x86_64.zip
        unzip aws-sam-cli-linux-x86_64.zip -d sam-installation
        sudo ./sam-installation/install --update
        sam --version

    - name: Configure AWS credentials
      uses: aws-actions/configure-aws-credentials@v1
      with:
        aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
        aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
        aws-region: us-east-2

    - name: Login to Amazon ECR
      id: login-ecr
      uses: aws-actions/amazon-ecr-login@v1

    - name: Build, tag, and push the image to Amazon ECR
      env:
        ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
        ECR_REPOSITORY: test-pinz-api
        IMAGE_TAG: latest
      run: |
        gulp publish --profile-name development

Using gulp we publish the environment using the below config file, development.json

{
    "apiDomainName": "domain",
    "assetsDomainName": "domain",
    "awsProfile": "Pinz",
    "bastionBucket": "bucketname",
    "corsDomains": ["domain"],
    "dbBackupSources": ["db source", "db source"],
    "dbClusterIdentifier": "cluster identfier",
    "designDomainName": "domain",
    "lambdaEcr": "ecr",
    "snsApplication": "sns",
    "snsServerKeySecretName": "name",
    "stackName": "name",
    "templateBucket": "bucketname",
    "userJwtPublicKey": "token",
    "websiteUrl": "domain",
    "wwwDomainName": "domain",
    "wwwEcr": "ecr repo"
}

In the YAML file, I run the command gulp publish --profile-name development

So it will reach out to development.json and publish the file

I couldn't figure out what could be wrong here.

honestly, I am new to the ECR deployment through pipeline and gulp is a new concept for me. Can anyone guide me on this?

If need more details comment down.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source