-
Notifications
You must be signed in to change notification settings - Fork 18
47 lines (41 loc) · 1.33 KB
/
build-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
name: build-and-push
on:
push:
branches:
- main
- release-*
tags:
- '*'
permissions:
contents: read
jobs:
build-and-push:
runs-on: ubuntu-latest
if: github.repository == 'ceph/ceph-csi-operator'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Quay.io
uses: docker/login-action@v3
with:
registry: quay.io
username: ${{ secrets.QUAY_IO_USERNAME }}
password: ${{ secrets.QUAY_IO_PASSWORD }}
- name: Set up Image tag
run: |
echo "image tag ${{ github.ref }}"
if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
echo "IMAGE_TAG=latest" >> $GITHUB_ENV
elif [[ "${{ github.ref }}" == refs/heads/* ]]; then
TAG=$(echo ${{ github.ref }} | sed 's/refs\/heads\///')
echo "IMAGE_TAG=${TAG}" >> $GITHUB_ENV
elif [[ "${{ github.ref }}" == refs/tags/* ]]; then
TAG=$(echo ${{ github.ref }} | sed 's/refs\/tags\///')
echo "IMAGE_TAG=${TAG}" >> $GITHUB_ENV
fi
- name: Build and push Docker images
run: make docker-buildx IMAGE_TAG=${{ env.IMAGE_TAG }}