-
Notifications
You must be signed in to change notification settings - Fork 165
82 lines (71 loc) · 2.26 KB
/
push-e2e-runner.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
74
75
76
77
78
79
80
81
82
name: Build & Push e2e-runner Image to Quay.io
on:
push:
branches:
- main
- release-1.**
paths:
- '.ibm/images/Dockerfile'
- '.yarnrc.yml'
workflow_dispatch:
inputs:
branch:
description: Target branch to build
required: true
default: 'NONE'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
REGISTRY: quay.io
REGISTRY_IMAGE: rhdh-community/rhdh-e2e-runner
jobs:
build-image:
name: Build & Push e2e-runner Image
strategy:
fail-fast: false
matrix:
os: [ubuntu-24.04]
runs-on: ${{ matrix.os }}
permissions:
contents: read
packages: write
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Prepare Environment Variables
run: |
echo "PLATFORM=linux/amd64" >> $GITHUB_ENV
# create image tag from the correct branch (either from a push or a workflow_dispatch trigger)
if [[ "${{ inputs.branch }}" ]] && [[ "${{ inputs.branch }}" != "NONE" ]]; then
echo "Switch to ${{ inputs.branch }}"
git checkout "${{ inputs.branch }}"
IMAGE_TAG="${{ inputs.branch }}"
else
echo "Use current branch ${{ github.ref }}"
IMAGE_TAG=$(git rev-parse --abbrev-ref HEAD)
fi
echo "Use IMAGE_TAG = $IMAGE_TAG"
echo "IMAGE_TAG=$IMAGE_TAG" >> $GITHUB_ENV
- name: Get the last commit short SHA
uses: ./.github/actions/get-sha
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Quay.io
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_TOKEN }}
- name: Build and Push Image
uses: docker/build-push-action@v5
with:
context: .
file: .ibm/images/Dockerfile
push: true
tags: |
${{ env.REGISTRY }}/${{ env.REGISTRY_IMAGE }}:${{ env.IMAGE_TAG }}
${{ env.REGISTRY }}/${{ env.REGISTRY_IMAGE }}:${{ env.IMAGE_TAG }}-${{ env.SHORT_SHA }}
platforms: ${{ env.PLATFORM }}