-
Notifications
You must be signed in to change notification settings - Fork 4
75 lines (61 loc) · 1.93 KB
/
build-push-quay.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
name: build-push-quay
on:
push:
branches:
- v0.9.6
- 0.9.7-dev
- climb
paths:
- '**/Dockerfile*'
- "bin/"
workflow_dispatch:
jobs:
docker_matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set_matrix.outputs.GIT-COMMITS }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Get Dockerfile names from commits
id: set_matrix
run: |
echo -n ::set-output name=GIT-COMMITS::
COMMITS=$(git diff --name-only ${{ github.event.before }}..${{ github.event.after }} **/Dockerfile* | jq -R '[.]' | jq -s -c 'add')
echo "${COMMITS}"
build:
needs: docker_matrix
runs-on: ubuntu-latest
strategy:
matrix:
dockerfile: ${{ fromJson(needs.docker_matrix.outputs.matrix) }}
fail-fast: false
steps:
- uses: actions/checkout@v3
- name: Copy folders to docker
run: |
cp -r bin docker/bin
- name: Get image name
id: image_name
run: |
echo -n ::set-output name=IMAGE_NAME::
NAME=$(echo ${{ matrix.dockerfile }} | awk -F '[.-]' '{print $2}')
echo "${NAME}"
- name: Get image tags
id: image_tags
run: |
echo -n ::set-output name=IMAGE_TAGS::
TAGS=$(echo ${{ matrix.dockerfile }} | awk -F '[-]' '{print $2}')
TAGS+=('latest')
( IFS=$','; echo "${TAGS[*]}" )
- name: Build and publish image to Quay
uses: docker/build-push-action@v1
with:
path: docker
dockerfile: ${{ matrix.dockerfile }}
registry: ${{ secrets.REGISTRY_SERVER }}
repository: ${{ secrets.REGISTRY_NAMESPACE }}/${{ steps.image_name.outputs.IMAGE_NAME }}
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
tags: "${{ steps.image_tags.outputs.IMAGE_TAGS }}"