This repository was archived by the owner on Jun 28, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
70 lines (56 loc) · 1.92 KB
/
docker.yml
File metadata and controls
70 lines (56 loc) · 1.92 KB
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
name: Build Java Docker Images
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build-test:
runs-on: ubuntu-latest
strategy:
matrix:
jdk: [ "11", "12", "13", "14", "15", "16", "17" ]
steps:
- name: Check out repository
uses: actions/checkout@v2
- name: Cache Gradle Caches
uses: actions/cache@v2
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-caches-${{ hashFiles('**/*.gradle') }}-${{ hashFiles('gradle.properties') }}
restore-keys: ${{ runner.os }}-gradle-caches
- name: Cache Gradle Wrapper
uses: actions/cache@v2
with:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
restore-keys: ${{ runner.os }}-gradle-wrapper
- name: Set up JDK
uses: actions/setup-java@v1
with:
java-version: 15
- name: Build the OpenJDK Docker images
run: ./gradlew -s dockerTag-${{ matrix.jdk }}
- name: Print the created images
run: docker image ls
- name: Publish Docker images
if: github.ref == 'refs/heads/main'
run: |
docker login -u ${{ secrets.DOCKER_HUB_USER }} -p ${{ secrets.DOCKER_HUB_PWD }}
./gradlew -s dockerPush-${{ matrix.jdk }}
docker logout
- name: Dump docker logs on failure
if: failure()
uses: jwalton/gh-docker-logs@v1
with:
dest: ${{ github.workspace }}/dockerlogs
- name: Tar logs
if: failure()
run: tar cvzf ${{ github.workspace }}/dockerlogs.tgz ${{ github.workspace }}/dockerlogs
- name: Upload Docker Logs
if: failure()
uses: actions/upload-artifact@v2
with:
name: Docker Logs
path: ${{ github.workspace }}/dockerlogs.tgz
if-no-files-found: error