feature: adding postman collection #30
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: | |
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 | |
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/trivy-action@0.21.0 | |
with: | |
image-ref: "ghcr.io/${{ github.repository }}:${{ steps.short-sha.outputs.sha }}" | |
format: 'github' | |
scan-type: 'image' | |
exit-code: '1' | |
ignore-unfixed: true | |
vuln-type: 'os,library' | |
severity: 'CRITICAL,HIGH' | |
output: 'dependency-results.sbom.json' | |
github-pat: "${{ secrets.GITHUB_TOKEN }}" | |
- 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 }} |