Skip to content

Commit 79bdcb6

Browse files
Merge pull request #6 from RemDelaporteMathurin/publish_docker
Automatically publish docker image
2 parents 58a3ec0 + 30a450f commit 79bdcb6

1 file changed

Lines changed: 40 additions & 0 deletions

File tree

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: ci
2+
3+
on:
4+
push:
5+
branches:
6+
- 'main'
7+
tags:
8+
- 'v*'
9+
pull_request:
10+
branches:
11+
- 'main'
12+
13+
jobs:
14+
docker:
15+
runs-on: ubuntu-latest
16+
steps:
17+
-
18+
name: Checkout
19+
uses: actions/checkout@v3
20+
-
21+
name: Docker meta
22+
id: meta
23+
uses: docker/metadata-action@v4
24+
with:
25+
images: name/app
26+
-
27+
name: Login to DockerHub
28+
if: github.event_name != 'pull_request'
29+
uses: docker/login-action@v2
30+
with:
31+
username: ${{ secrets.DOCKERHUB_USERNAME }}
32+
password: ${{ secrets.DOCKERHUB_TOKEN }}
33+
-
34+
name: Build and push
35+
uses: docker/build-push-action@v3
36+
with:
37+
context: .
38+
push: ${{ github.event_name != 'pull_request' }}
39+
tags: ${{ steps.meta.outputs.tags }}
40+
labels: ${{ steps.meta.outputs.labels }}

0 commit comments

Comments
 (0)