-
Notifications
You must be signed in to change notification settings - Fork 19
60 lines (51 loc) · 1.8 KB
/
build-and-publish.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
---
name: Build and Publish
on:
push:
branches:
- redhat-** # IMPORTANT! this must match the jobs.build-and-publish.env.BRANCH_PREFIX (save the **).
workflow_dispatch:
# Allows you to run this workflow manually from the Actions tab
inputs:
tag:
description: 'Tag to attach to image'
required: true
jobs:
build-and-publish:
name: Publish container image
env:
BRANCH_PREFIX: redhat- # IMPORTANT! this must match the .on.push.branches prefix!
REGISTRY: quay.io/projectquay
REPO_NAME: ${{ github.event.repository.name }}
TAG_SUFFIX: -unstable
runs-on: 'ubuntu-latest'
steps:
- name: Check out the repo
uses: actions/checkout@v2
- name: Set version from branch name
id: version-from-branch
if: startsWith('env.BRANCH_PREFIX', env.GITHUB_REF)
run: |
BRANCH_NAME=${GITHUB_REF#refs/heads/}
echo "::set-output name=version::${BRANCH_NAME/${{ env.BRANCH_PREFIX }}/}"
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Quay.io
uses: docker/login-action@v1
with:
registry: quay.io
username: ${{ secrets.QUAY_USER }}
password: ${{ secrets.QUAY_TOKEN }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
env:
TAG: ${{ steps.version-from-branch.outputs.version }}${{ env.TAG_SUFFIX }}
with:
platforms: linux/amd64,linux/s390x,linux/ppc64le
build-args: BUILDER_SRC=github.com/quay/quay-builder
push: true
file: Dockerfile
tags: ${{ env.REGISTRY }}/${{ env.REPO_NAME }}:${{ github.event.inputs.tag || env.TAG }}