Feature/fix warnings #9
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build Aplication | |
on: | |
workflow_dispatch: | |
pull_request: | |
branches: | |
- main | |
jobs: | |
Package: | |
name: Build Test And Push Image | |
runs-on: ubuntu-latest | |
permissions: write-all | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- uses: benjlevesque/short-sha@v3.0 | |
id: short-sha | |
with: | |
length: 7 | |
- name: SonarCloud Scan | |
uses: SonarSource/sonarcloud-github-action@master | |
env: | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
SHA: ${{ steps.short-sha.outputs.sha }} | |
with: | |
args: > | |
-Dsonar.organization=pangolin-do-golang | |
-Dsonar.projectKey=pangolin-do-golang_tech-challenge | |
-Dsonar.projectVersion=${{ env.SHA }} | |
-Dsonar.qualitygate.wait=true | |
-Dsonar.verbose=true | |
- name: Run Snyk to check for vulnerabilities | |
uses: snyk/actions/golang@master | |
env: | |
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }} | |
with: | |
args: --severity-threshold=high | |
- name: Login to GitHub Container Registry | |
id: login-ecr | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build, tag, docker image | |
env: | |
REGISTRY: ghcr.io | |
REPOSITORY: ${{ github.repository }} | |
IMAGE_TAG: ${{ steps.short-sha.outputs.sha }} | |
run: | | |
docker build -t $REGISTRY/$REPOSITORY:$IMAGE_TAG . | |
- name: Scan Docker image | |
uses: snyk/actions/docker@master | |
continue-on-error: true | |
with: | |
image: "${REGISTRY}/${REPOSITORY}:${IMAGE_TAG}" | |
args: --file=Dockerfile --severity-threshold=high #--sarif-file-output=snyk.sarif | |
env: | |
REGISTRY: ghcr.io | |
REPOSITORY: ${{ github.repository }} | |
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }} | |
IMAGE_TAG: ${{ steps.short-sha.outputs.sha }} | |
- name: Push docker image to Amazon ECR | |
env: | |
REGISTRY: ghcr.io | |
REPOSITORY: ${{ github.repository }} | |
IMAGE_TAG: ${{ steps.short-sha.outputs.sha }} | |
run: | | |
docker push $REGISTRY/$REPOSITORY:$IMAGE_TAG |