-
Notifications
You must be signed in to change notification settings - Fork 17
66 lines (66 loc) · 2.12 KB
/
build.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
name: Build
on:
push:
branches: [ main ]
tags:
- v*
pull_request:
types: [ opened, reopened ]
branches: [ main ]
jobs:
build-with-maven:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2
- name: Set up JDK 8
uses: actions/setup-java@v2
with:
java-version: '17'
distribution: 'temurin'
- name: Cache Maven packages
uses: actions/cache@v2
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Generate build info
run: ./generate-build-info.sh
- name: Generate keystore
run: ./generate-keystore.sh
- name: Build with Maven
run: mvn --batch-mode --update-snapshots verify
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v3
with:
images: ${{ github.repository_owner }}/${{ github.event.repository.name }}
- name: Log in to Docker Hub
if: ${{ github.event.repository.name == 'spring-boot-scala-example' && github.event_name != 'pull_request' }}
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: .
push: ${{ github.event.repository.name == 'spring-boot-scala-example' && github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-with-sbt:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
java-version: '17'
distribution: 'temurin'
- name: Generate build info
run: ./generate-build-info.sh
- name: Generate keystore
run: ./generate-keystore.sh
- name: Build with sbt
run: sbt -v test assembly