-
Notifications
You must be signed in to change notification settings - Fork 41
77 lines (65 loc) · 2.46 KB
/
maven.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
name: Banking CI Master
on:
push:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
# Disabling shallow clone is recommended for improving relevancy of reporting
fetch-depth: 0
- name: Spin Database Container
run: docker run -d --rm -e MYSQL_ROOT_PASSWORD=root -p 3306:3306 mariadb:10.3 --lower_case_table_names=1
- name: Set up JDK 1.11
uses: actions/setup-java@v1
with:
java-version: 1.11
- name: Cache Maven Dependecies
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Build with Maven
run: mvn clean verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar
env:
# These two env variables are needed for sonar analysis
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
GCP_MYSQL_DB_HOST: 0.0.0.0
GCP_MYSQL_DB_PORT: 3306
GCP_MYSQL_DB_UNAME: root
GCP_MYSQL_DB_PASSWD: root
# GCP_MYSQL_DB_HOST: ${{ secrets.GCP_MYSQL_DB_HOST }}
# GCP_MYSQL_DB_PORT: ${{ secrets.GCP_MYSQL_DB_PORT }}
# GCP_MYSQL_DB_UNAME: ${{ secrets.GCP_MYSQL_DB_UNAME }}
# GCP_MYSQL_DB_PASSWD: ${{ secrets.GCP_MYSQL_DB_PASSWD }}
- name: Extract branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/} | tr / -)"
id: extract_branch
- name: Build and Push Retail Banking Application to DockerHub
uses: docker/[email protected]
with:
username: ${{ secrets.DOCKERHUB_UNAME }}
password: ${{ secrets.DOCKERHUB_PASSWD }}
registry: docker.io
repository: subhrodip/retail-banking
tags: ${{ steps.extract_branch.outputs.branch }},latest
labels: pipeline_build=true,cloud_build=true
always_pull: true
push: true
- name: Build and Push Retail Banking Application to GitHub Packages
uses: docker/[email protected]
with:
username: ohbus
password: ${{ secrets.GITHUB_TOKEN }}
registry: docker.pkg.github.com
repository: ohbus/retail-banking/retail-banking
tags: ${{ steps.extract_branch.outputs.branch }},latest
labels: pipeline_build=true,cloud_build=true
always_pull: true
push: true