-
Notifications
You must be signed in to change notification settings - Fork 2
43 lines (36 loc) · 1.57 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
name: Docker Build Image and Push
on:
workflow_dispatch:
inputs:
tag:
description: 'Tag for the image'
required: true
default: SNAPSHOT
cache:
description: 'Run the build with cache'
required: false
default: true
debug_enabled:
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
required: false
default: false
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v2
# Loads cache if it exists and creates cache in the post run
- uses: satackey/action-docker-layer-caching@v0
continue-on-error: true
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled }}
- name: Build the tagged Docker image
run: docker build . --progress=plain --file docker/Dockerfile --tag animeshz/keyboard-mouse-kt:${{github.event.inputs.tag}}
- name: Login to DockerHub Registry
run: echo ${{ secrets.DOCKERHUB_PASSWORD }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
- name: Push the tagged Docker image
run: docker push animeshz/keyboard-mouse-kt:${{github.event.inputs.tag}}
# Enable tmate debugging if above jobs failed or if manually-triggered workflows with debug option
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
if: ${{ failure() && (github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled) }}