Skip to content

made some changes

made some changes #16

Workflow file for this run

name: NestJS CI/CD pipeline
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
building:

Check failure on line 12 in .github/workflows/main.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/main.yml

Invalid workflow file

You have an error in your yaml syntax on line 12
name: Building and pushing image to AWS ECR
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Nodejs
uses: actions/setup-node@v4
with:
node-version: 18.20.0
- run: npm ci
- name: Creating .env file
run: |
mkdir temp
touch temp/.env
touch temp/myfile.txt
echo DATABASE_URL=${{secrets.DATABASE_URL}} > temp/.env
echo JWT_SECRET=${{secrets.JWT_SECRET}} > temp/.env
echo AWS_ACCESS_KEY=${{secrets.AWS_ACCESS_KEY}} > temp/.env
echo AWS_SECRET_KEY=${{secrets.AWS_SECRET_KEY}} > temp/.env
echo AWS_S3_REGION=${{secrets.AWS_REGION}} > temp/.env
echo AWS_S3_BUCKET=${{secrets.AWS_BUCKET}} > temp/.env
echo POSTGRES_PASSWORD=${{secrets.DB_PASSWORD}} > temp/.env
echo POSTGRES_USER=${{secrets.DB_USER}} > temp/.env
echo POSTGRES_DB=${{secrets.DB}} > temp/.env
echo POSTGRES_PORT=${{secrets.DB_PORT}} > temp/.env
cat temp/.env
cat temp/myfile.txt
- name: checking file creation
run: |
ls -la
pwd
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_KEY }}
aws-region: ${{secrets.AWS_REGION}}
- name: Login to AWS ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2
- name: Build,tag and push Docker image to AWS ECR
id: docker-image-build
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry}}
ECR_REPOSITORY: ${{ secrets.REPOSITORY_NAME}}
IMAGE_TAG: latest
run: |
echo "Building docker image......"
ls -la
pwd
docker buildx build --build-context generated=./temp -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
echo "Pushing docker image to AWS ECR......"
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
echo "Done......."