Skip to content

Commit c2688fa

Browse files
committed
Set up CI to Docker Hub using GitHub Actions
1 parent 7538573 commit c2688fa

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

.github/workflows/ci.yaml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
name: CI
3+
4+
on:
5+
push:
6+
branches:
7+
- master
8+
pull_request:
9+
10+
jobs:
11+
docker:
12+
runs-on: ubuntu-latest
13+
steps:
14+
-
15+
name: Set up Docker Buildx
16+
uses: docker/setup-buildx-action@v1
17+
with:
18+
install: true
19+
-
20+
name: Login to DockerHub
21+
if: github.event_name != 'pull_request'
22+
uses: docker/login-action@v1
23+
with:
24+
username: ${{ secrets.DOCKERHUB_USERNAME }}
25+
password: ${{ secrets.DOCKERHUB_TOKEN }}
26+
-
27+
name: Determine metadata for DockerHub
28+
id: meta
29+
uses: docker/metadata-action@v3
30+
with:
31+
images: ${{ secrets.DOCKERHUB_USERNAME }}/wikidocumentaries-api
32+
flavor: |
33+
latest=${{ github.ref == 'refs/heads/master' }}
34+
-
35+
name: Build and push to DockerHub
36+
uses: docker/build-push-action@v2
37+
with:
38+
push: ${{ github.event_name != 'pull_request' }}
39+
tags: ${{ steps.meta.outputs.tags }}
40+
labels: ${{ steps.meta.outputs.labels }}

0 commit comments

Comments
 (0)