chore(deps): update all patch dependencies (#1406) #1210
This file contains hidden or 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 and Push Container to ECR | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: [main] | |
| env: | |
| GITHUB_SHA: ${{ github.sha }} | |
| REGISTRY: 806545929748.dkr.ecr.ca-central-1.amazonaws.com/scan-files | |
| permissions: | |
| id-token: write | |
| contents: write | |
| pull-requests: write | |
| actions: write | |
| checks: write | |
| statuses: write | |
| security-events: write | |
| jobs: | |
| changes: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| images: ${{ steps.filter.outputs.changes }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| - uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2 | |
| id: filter | |
| with: | |
| filters: | | |
| api: 'api/**' | |
| module/s3-scan-object: 'module/s3-scan-object/**' | |
| build-push-and-deploy: | |
| if: needs.changes.outputs.images != '[]' | |
| runs-on: ubuntu-latest | |
| needs: changes | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| image: ${{ fromJSON(needs.changes.outputs.images) }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| - name: Configure AWS credentials using OIDC | |
| uses: aws-actions/configure-aws-credentials@00943011d9042930efac3dcd3a170e4273319bc8 # v5.1.0 | |
| with: | |
| role-to-assume: arn:aws:iam::806545929748:role/scan-files-apply | |
| role-session-name: ECRPush | |
| aws-region: ca-central-1 | |
| - name: Build container | |
| working-directory: ./${{ matrix.image }} | |
| run: | | |
| docker build \ | |
| --build-arg GIT_SHA=$GITHUB_SHA \ | |
| -t $REGISTRY/${{ matrix.image }}:$GITHUB_SHA \ | |
| -t $REGISTRY/${{ matrix.image }}:latest . | |
| - name: Login to ECR | |
| id: login-ecr | |
| uses: aws-actions/amazon-ecr-login@062b18b96a7aff071d4dc91bc00c4c1a7945b076 # v2.0.1 | |
| - name: Push containers to ECR | |
| run: | | |
| docker push $REGISTRY/${{ matrix.image }}:$GITHUB_SHA | |
| docker push $REGISTRY/${{ matrix.image }}:latest | |
| - name: Docker generate SBOM | |
| uses: cds-snc/security-tools/.github/actions/generate-sbom@34794baf2af592913bb5b51d8df4f8d0acc49b6f # v3.2.0 | |
| env: | |
| TRIVY_DB_REPOSITORY: ${{ vars.TRIVY_DB_REPOSITORY }} | |
| with: | |
| docker_image: "${{ env.REGISTRY }}/${{ matrix.image }}:${{ env.GITHUB_SHA }}" | |
| dockerfile_path: "${{ matrix.image }}/Dockerfile" | |
| sbom_name: "${{ matrix.image }}" | |
| token: "${{ secrets.GITHUB_TOKEN }}" | |
| - name: Logout of Amazon ECR | |
| if: always() | |
| run: docker logout ${{ steps.login-ecr.outputs.registry }} |