-
Notifications
You must be signed in to change notification settings - Fork 0
88 lines (78 loc) · 2.36 KB
/
image.yml
File metadata and controls
88 lines (78 loc) · 2.36 KB
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
81
82
83
84
85
86
87
88
name: "Docker Hub Images"
on:
pull_request:
paths:
- 'Dockerfile'
- '.github/workflows/image.yml'
schedule:
- cron: '0 10 * * *' # everyday at 10am UTC
release:
types: [ published ]
push:
branches:
- main
workflow_dispatch:
inputs:
version:
required: false
description: 'Version (eg. v2.5.0)'
default: latest
jobs:
registry:
name: Publish to Registry
runs-on: ubuntu-latest
steps:
- name: Checkout Latest Stable Version
if: ${{ github.event.inputs.version }} == 'latest'
uses: actions/checkout@v2.4.0
- name: Checkout ${{ github.event.inputs.version }}
if: github.event.inputs.version != 'latest'
uses: actions/checkout@v2.4.0
with:
ref: ${{ github.event.inputs.version }}
- name: Setup repo name to lowercase
id: reponame
uses: ASzc/change-string-case-action@v2
with:
string: ${{ github.repository }}
- name: docker meta
id: meta
uses: docker/metadata-action@v3
with:
images: |
${{steps.reponame.outputs.lowercase}}
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
with:
config: buildkitd.toml
- name: Cache Docker layers
uses: actions/cache@v2.1.7
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Login to Docker hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USER }}
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
platforms: linux/amd64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max