This repository has been archived by the owner on Nov 27, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
73 lines (62 loc) · 2.09 KB
/
push.yaml
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
name: Build container images
on: # yamllint disable-line rule:truthy
push:
branches: [main]
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
env:
GO_VERSION: 1.22
jobs:
build:
name: Build images
runs-on: ubuntu-22.04
strategy:
matrix:
include:
- directory: server
image_base: quay.io/konflux-workspaces/workspaces-server
- directory: operator
image_base: quay.io/konflux-workspaces/workspaces-operator
steps:
- name: Checkout Git Repository
uses: actions/checkout@v4
if: ${{ github.event_name == 'pull_request' }}
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
- name: Checkout Git Repository
uses: actions/checkout@v4
if: ${{ github.event_name == 'push' }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache: false
- name: Determine image tag
id: tag
run: |
if [[ "${GITHUB_EVENT_NAME}" -eq "pull_request_target" ]]; then
echo "tag=${{ matrix.image_base }}:pr-${{ github.event.pull_request.number }}-${GITHUB_SHA:0:8}" >> ${GITHUB_OUTPUT}
else
echo "tag=${{ matrix.image_base }}:${GITHUB_SHA:0:8}" >> ${GITHUB_OUTPUT}
fi
- name: Build image
env:
LATEST: ${{ matrix.image_base }}:latest
IMG: ${{ steps.tag.outputs.tag }}
run: |
make -C "${{ matrix.directory }}" docker-build
if [[ "${GITHUB_EVENT_NAME}" -eq "push" ]]; then
docker tag "${IMG}" "${LATEST}"
fi
- name: Login to Quay
uses: docker/login-action@v3
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_TOKEN }}
- name: Push images
run: |
docker push -a ${{ matrix.image_base }}