Skip to content

Commit

Permalink
added sonar action
Browse files Browse the repository at this point in the history
  • Loading branch information
f-bguiga committed May 22, 2024
1 parent f9b618e commit fd4ee1f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 28 deletions.
42 changes: 14 additions & 28 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,40 +1,26 @@
name: deploy
name: Build

on:
push:
branches:
- main
paths-ignore:
- '**.md'


jobs:
build:
name: Build
runs-on: ubuntu-latest

steps:
- name: Install & Build
uses: actions/checkout@v2
- run: yarn install --frozen-lockfile
- run: yarn build && yarn install --production --ignore-scripts --prefer-offline

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

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

- name: Build, tag, and push image to Amazon ECR
id: build-image
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- uses: sonarsource/sonarqube-scan-action@master
env:
ECR_REGISTRY: 600453241670.dkr.ecr.us-east-1.amazonaws.com
ECR_REPOSITORY: next-docker
IMAGE_TAG: latest
run: |
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
echo "::set-output name=image::$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG"
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
# If you wish to fail your job when the Quality Gate is red, uncomment the
# following lines. This would typically be used to fail a deployment.
# - uses: sonarsource/sonarqube-quality-gate-action@master
# timeout-minutes: 5
# env:
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
1 change: 1 addition & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
sonar.projectKey=f-bguiga_next-docker_AY-fTHoRfukTexZf2BjO

0 comments on commit fd4ee1f

Please sign in to comment.