-
Notifications
You must be signed in to change notification settings - Fork 11
65 lines (57 loc) · 2.09 KB
/
docker.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
53
54
55
56
57
58
59
60
61
62
63
64
65
name: Docker
# Build & Push rebuilds the Tenderdash docker image every time a release is published
# and pushes the image to https://hub.docker.com/r/dashpay/tenderdash/tags
on:
workflow_dispatch:
release:
types:
- published
jobs:
build:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2.3.4
- name: Set up QEMU
uses: docker/setup-qemu-action@master
with:
platforms: all
- name: Set up Docker Build
uses: docker/setup-buildx-action@v1.7.0
- name: Login to DockerHub
if: ${{ github.event_name != 'pull_request' }}
uses: docker/login-action@v1.14.1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set suffix to Docker tags
uses: actions/github-script@v6
id: suffix
with:
result-encoding: string
script: "return (context.payload.release.tag_name.includes('-dev') ? '-dev' : '');"
- name: Set Docker tags and labels
id: docker_meta
uses: docker/metadata-action@v3
with:
images: dashpay/tenderdash
tags: |
type=match,pattern=v(\d+),group=1
type=match,pattern=v(\d+.\d+),group=1
type=match,pattern=v(\d+.\d+.\d+),group=1
type=match,pattern=v(.*),group=1,suffix=,enable=${{ contains(github.event.release.tag_name, '-dev') }}
flavor: |
latest=${{ !contains(github.event.release.tag_name, '-dev') }}
suffix=${{ steps.suffix.outputs.result }}
- name: Publish to Docker Hub
uses: docker/build-push-action@v2.10.0
with:
context: .
file: ./DOCKER/Dockerfile
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Show Docker image digest
run: echo ${{ steps.docker_build.outputs.digest }}