-
Notifications
You must be signed in to change notification settings - Fork 4
46 lines (38 loc) · 1.43 KB
/
publish.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
name: Publish Images
on:
push:
branches:
- master
- 'release-*.*.*'
- 'sprint-*'
tags:
- 'release-*.*.*'
workflow_dispatch:
env:
REGISTRY: quay.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Extract branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: extract_branch
- name: Build container image
run: docker build . --file Dockerfile --tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.extract_branch.outputs.branch }}
- name: Log into registry
run: echo "${{ secrets.QUAY_PUBLISH_TOKEN }}" | docker login quay.io -u ${{ secrets.QUAY_PUBLISH_ROBOT }} --password-stdin
- name: Push container image
run: docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.extract_branch.outputs.branch }}
- name: Retag container image
run: docker tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.extract_branch.outputs.branch }} ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
if: ${{ github.ref == 'refs/heads/master' }}
- name: push retagged container image
run: docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
if: ${{ github.ref == 'refs/heads/master' }}