-
Notifications
You must be signed in to change notification settings - Fork 31
80 lines (74 loc) · 2.53 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
name: Docker
on:
workflow_dispatch:
release:
types: [published]
# Automatically cancel previous runs for the same ref (i.e. branch) and event type. The latter component prevents
# manually dispatched events from being cancelled by pushes to the `master` branch.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
cancel-in-progress: true
jobs:
build-and-push-chia-gigahorse-image:
name: Build and push chia-gigahorse image
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
strategy:
fail-fast: false
matrix:
include:
- final-build-stage: 'base'
latest-tag-behaviour: auto
version-suffix: ''
suffix-onlatest: false
- final-build-stage: nvidia
latest-tag-behaviour: auto
version-suffix: '-nvidia'
suffix-onlatest: true
- final-build-stage: intel
latest-tag-behaviour: auto
version-suffix: '-intel'
suffix-onlatest: true
- final-build-stage: amd
latest-tag-behaviour: auto
version-suffix: '-amd'
suffix-onlatest: true
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Extract metadata for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
flavor: |
latest=${{ matrix.latest-tag-behaviour }}
suffix=${{ matrix.version-suffix }},onlatest=${{ matrix.suffix-onlatest }}
tags: |
type=match,pattern=\d+.\d+.\d+.*
type=match,pattern=\d+.\d+
type=match,pattern=\d+
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to the container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v3
with:
context: .
build-args: GIT_RELEASE=${{ steps.meta.outputs.version }}
target: ${{ matrix.final-build-stage }}
push: ${{ startsWith(github.ref, 'refs/tags/v') }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max