-
Notifications
You must be signed in to change notification settings - Fork 0
51 lines (42 loc) · 1.46 KB
/
ci-cd.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
44
45
46
47
48
49
50
51
name: CI
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the "main" branch
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
build-examples:
runs-on: ubuntu-latest
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
# Runs a set of commands using the runners shell
- name: Maven Package
run: |
cd examples/word-count
mvn clean package
- name: Log in to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/word-count:latest
# - name: Docker Build
# run: |
# cd examples/word-count
# docker build -t ${{ secrets.DOCKERHUB_USERNAME }}/word-count:latest .
# - name: Docker Push
# run: |
# cd examples/word-count
# docker tag word-count:latest ${{ secrets.DOCKERHUB_USERNAME }}/word-count:latest
# docker push ${{ secrets.DOCKERHUB_USERNAME }}/word-count:latest