generated from cds-snc/project-template
-
Notifications
You must be signed in to change notification settings - Fork 0
45 lines (39 loc) · 1.17 KB
/
docker-build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- 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@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- 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 }} .