chore: synced file(s) with cds-snc/site-reliability-engineering #1345
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: Docker build | |
on: | |
pull_request: | |
branches: | |
- main | |
jobs: | |
changes: | |
runs-on: ubuntu-latest | |
outputs: | |
images: ${{ steps.filter.outputs.changes }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
- uses: dorny/paths-filter@7267a8516b6f92bdb098633497bad573efdbf271 # v2.12.0 | |
id: filter | |
with: | |
filters: | | |
saas_app: 'saas_app/**' | |
build: | |
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@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
- name: Get current date and time | |
id: date | |
run: echo "::set-output name=date::$(date +'%Y-%m-%d-%H:%M:%S')" | |
- name: Build image | |
working-directory: ./${{ matrix.image }} | |
run: | | |
docker build \ | |
-t ${{ matrix.image }}:latest \ | |
--build-arg GIT_SHA=${{ github.sha }} \ | |
--build-arg BUILD_DATE=${{ steps.date.outputs.date }} . |