This repository has been archived by the owner on Dec 2, 2024. It is now read-only.
Remove Snyk stage #57
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: | |
push: | |
branches: | |
- main | |
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/[email protected] | |
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-golang | |
-Dsonar.projectKey=pangolin-do-golang_tech-challenge-order-api | |
-Dsonar.projectVersion=${{ env.SHA }} | |
-Dsonar.qualitygate.wait=true | |
-Dsonar.verbose=true | |
- name: Login to GitHub Container Registry | |
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: Run Trivy Vulnerability Scanner | |
uses: aquasecurity/[email protected] | |
with: | |
image-ref: "ghcr.io/${{ github.repository }}:${{ steps.short-sha.outputs.sha }}" | |
format: 'table' | |
scan-type: 'image' | |
exit-code: '1' | |
ignore-unfixed: true | |
vuln-type: 'os,library' | |
severity: 'CRITICAL,HIGH' | |
- name: Push docker image to Registry | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
run: | | |
docker push $REGISTRY/$REPOSITORY:$IMAGE_TAG | |
env: | |
REGISTRY: ghcr.io | |
REPOSITORY: ${{ github.repository }} | |
IMAGE_TAG: ${{ steps.short-sha.outputs.sha }} |