-
Notifications
You must be signed in to change notification settings - Fork 5
38 lines (35 loc) · 1.14 KB
/
push-to-docker-hub.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
name: Build, scan and push to Docker Hub
on:
push:
tags:
- '*'
branches:
- master
jobs:
push_to_docker_hub:
name: Push Stats Pusher Docker image to Docker Hub
# This uses the default metadata-action configuration, see https://github.com/docker/metadata-action
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v2
- name: Set up Docker metadata
id: meta
uses: docker/metadata-action@v3
with:
# Use different container name:
images: ukwa/monitor-stat-pusher
- name: Log in to Docker Hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Build and push to Docker Hub
uses: docker/build-push-action@v2
with:
# Use different build context:
context: ./stat-pusher
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}