-
-
Notifications
You must be signed in to change notification settings - Fork 46
78 lines (70 loc) · 2.32 KB
/
dockerhub-publisher.yaml
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
name: Publish to Docker Hub
on:
#Push trigger
push:
branches:
- master
- vlc-support
paths:
- 'Dockerfile'
- 'LICENSE'
- 'README.md'
tags:
- '[0-9]+.[0-9]+.[0-9]+.[0-9]+'
#Manual dispatch trigger
workflow_dispatch:
#Remote github trigger
repository_dispatch:
types: execute
jobs:
push_to_registry:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
env:
DOCKERHUB_IMAGE: doitandbedone/ispyagentdvr
steps:
- name: Check out repo
uses: actions/checkout@v3
- name: Log into Docker Hub
uses: docker/login-action@v2
with:
username: ${{secrets.DOCKERHUB_USERNAME}}
password: ${{secrets.DOCKERHUB_TOKEN}}
- name: Extract metadata (tags, labels) for Docker for non-latest
id: meta-non-latest
uses: docker/metadata-action@v4
with:
flavor: |
latest=false
images: ${{env.DOCKERHUB_IMAGE}}
- name: Get the ref name
run: echo REF_NAME=${GITHUB_REF/refs\/*\//} >> $GITHUB_ENV
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: doitandbedone/ispyagentdvr
- name: Build and push Docker image for tags
if: startsWith(github.ref, 'refs/tags/')
uses: docker/build-push-action@v4
with:
context: .
push: ${{ github.event_name == 'push' }}
tags: '${{env.DOCKERHUB_IMAGE}}:${{env.REF_NAME}}'
labels: ${{ steps.meta-tag.outputs.labels }}
- name: Build and push Docker image for master
if: contains(github.ref, 'refs/heads/master')
uses: docker/build-push-action@v4
with:
context: .
push: ${{ github.event_name == 'push' }}
tags: '${{env.DOCKERHUB_IMAGE}}:latest'
labels: ${{ steps.meta.outputs.labels }}
- name: Build and push Docker image for vlc
if: contains(github.ref, 'refs/heads/vlc-support')
uses: docker/build-push-action@v4
with:
context: .
push: ${{ github.event_name == 'push' }}
tags: '${{env.DOCKERHUB_IMAGE}}:${{env.REF_NAME}}'
labels: ${{ steps.meta-non-latest.outputs.labels }}