-
Notifications
You must be signed in to change notification settings - Fork 3
62 lines (51 loc) · 1.7 KB
/
hcx-mock-build.yaml
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
52
53
54
55
56
57
58
59
60
61
62
name: HCX Provider Service - Build
on:
workflow_dispatch:
inputs:
repo:
description: Custom build repository to be used
required: false
branch:
description: Custom build branch to be used
required: false
# tags:
# - *
jobs:
build:
name: Build and Push Docker Image
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
repository: ${{ github.event.inputs.repo }}
ref: ${{ github.event.inputs.branch }}
- name: Set up JDK 17
uses: actions/setup-java@v1
with:
java-version: 17
- name: Cache Maven dependencies
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-maven-
- name: Maven Build
run: |
mvn clean install -DskipTests
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set the Image TAG
run: echo "IMAGE_TAG=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- name: Build and push Docker image for HCX Provider Service
uses: docker/build-push-action@v3
with:
context: ./
push: true
tags: swasth2021/hcx-provider-service:${{ env.IMAGE_TAG }}_${{ github.run_number }}
labels: hcx-provider-service image