Skip to content

Commit 879054b

Browse files
author
Eran Davidovich
committed
chore: Github Action push on branches only
Also add push with tags
1 parent 34b30dc commit 879054b

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

.github/workflows/docker-image.yml

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
name: Build Docker image
22

3-
on: [push]
3+
on:
4+
push:
5+
branches:
6+
- "main"
7+
tags:
8+
- "v*"
9+
10+
pull_request:
11+
branches:
12+
- "main"
413

514
jobs:
615
docker:
@@ -12,6 +21,12 @@ jobs:
1221
- name: Set up Docker Buildx
1322
uses: docker/setup-buildx-action@v1
1423

24+
- name: Docker meta
25+
id: meta
26+
uses: docker/metadata-action@v3
27+
with:
28+
images: ${{ secrets.DOCKERHUB_USERNAME }}/pyth-client-py
29+
1530
- name: Login to DockerHub
1631
uses: docker/login-action@v1
1732
with:
@@ -23,8 +38,9 @@ jobs:
2338
uses: docker/build-push-action@v2
2439
with:
2540
platforms: linux/amd64
26-
push: true
27-
tags: ${{ secrets.DOCKERHUB_USERNAME }}/pyth-client-py:latest
41+
push: ${{ github.event_name != 'pull_request' }}
42+
tags: ${{ steps.meta.outputs.tags }}
43+
labels: ${{ steps.meta.outputs.labels }}
2844

2945
- name: Image digest
3046
run: echo ${{ steps.docker_build.outputs.digest }}

0 commit comments

Comments
 (0)