-
Notifications
You must be signed in to change notification settings - Fork 16
74 lines (64 loc) · 2.22 KB
/
feature-alert.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
name: Alert Service
on:
# Currently triggered by develop workflow, so this trigger is disabled for now until we can fully separate them
# pull_request:
# paths:
# - 'alert/**'
workflow_call:
inputs:
image:
description: 'Name of the image to build'
required: false
type: string
image-tag:
description: 'Tag for the built image'
required: false
type: string
image-registry:
description: 'Docker image registry to tag and push to'
required: false
type: string
env:
IMAGE: ${{ inputs.image || 'lokahi-alert' }}
IMAGE_TAG: ${{ inputs.image-tag || github.sha }}
IMAGE_REGISTRY: ${{ inputs.image-registry || 'ghcr.io' }}
jobs:
build-and-test:
name: Build and test - Alert
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of SonarCloud analysis
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ${{ env.IMAGE_REGISTRY }}
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Generate Docker metadata
id: docker-metadata
uses: docker/[email protected]
with:
images: |
${{ env.IMAGE_REGISTRY }}/${{ github.repository_owner }}/${{ env.IMAGE }}
tags: |
type=raw,value=${{ env.IMAGE_TAG }}
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 17
- name: Cache Maven dependencies
uses: ./.github/actions/maven-cache
with:
cache-key-hash: ${{ hashFiles('alert/**/pom.xml', 'parent-pom/pom.xml', 'shared-lib/**/pom.xml') }}
- name: Build and install prerequisites
uses: ./.github/actions/java-install-prereqs
- name: Jib Maven build, scan, and push
uses: ./.github/actions/jib-maven-sonar
with:
working-directory: 'alert'
image: ${{ steps.docker-metadata.outputs.tags }}
github-token: ${{ secrets.GITHUB_TOKEN }}
sonar-token: ${{ secrets.SONAR_TOKEN }}