-
Notifications
You must be signed in to change notification settings - Fork 16
52 lines (51 loc) · 1.58 KB
/
image.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
47
48
49
50
51
52
---
name: build-image
on:
push:
jobs:
build:
runs-on: ubuntu-latest
env:
GH_REPO: c3genomics/ncov-tools
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build on all branch
id: alpha
uses: docker/build-push-action@v2
with:
push: true
tags: ${{ env.GH_REPO }}:alpha
cache-from: type=registry,ref=${{ env.GH_REPO }}:alpha
cache-to: type=inline
-
name: Docker meta
id: docker_meta
uses: crazy-max/ghaction-docker-meta@v1
with:
images: ${{ env.GH_REPO }} # list of Docker images to use as base name for tags
tag-sha: true # add git short SHA as Docker tag
- name: push latest
if: ${{ github.ref == 'ref/head/master' }}
id: latest
uses: docker/build-push-action@v2
with:
push: true
tags: ${{ env.GH_REPO }}:latest
cache-from: type=registry,ref=${{ env.GH_REPO }}:alpha
cache-to: type=inline
- name: push tag
if: contains(github.ref, 'tags/v')
id: tag
uses: docker/build-push-action@v2
with:
push: true
cache-from: type=registry,ref=${{ env.GH_REPO }}:alpha
cache-to: type=inline
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}