-
Notifications
You must be signed in to change notification settings - Fork 8
133 lines (115 loc) · 4.09 KB
/
gradle.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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# GitHub recommends pinning actions to a commit SHA.
# To get a newer version, you will need to update the SHA.
# You can also reference a tag or branch, but the action may change without warning.
name: Java CI
on:
push:
paths:
- src/**
- buildSrc/**
- .github/**
- build.gradle.kts
- settings.gradle.kts
tags:
- '**'
branches:
- 'develop'
pull_request:
paths:
- src/**
- buildSrc/**
- .github/**
- build.gradle.kts
- settings.gradle.kts
branches:
- '**'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up JDK 23
uses: actions/setup-java@v4
with:
java-version: '23'
distribution: 'temurin'
cache: 'gradle'
- name: Export branch name
uses: mad9000/actions-find-and-replace-string@5
id: branch_name
with:
source: ${{ github.ref_name }}
find: '/'
replace: '-'
- name: Log in to Docker Hub to pull images without rate limit
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Log into GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Gradle for a non-wrapper project
uses: gradle/actions/setup-gradle@v4
with:
gradle-version: 8.10.2
- name: Build JVM OCI image
run: gradle jib -Djib.serialize=true # https://github.com/GoogleContainerTools/jib/issues/4301
env:
LANG: "en_US.UTF-8"
LC_ALL: "en_US.UTF-8"
USERNAME: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DOCKERHUB_USER: ${{ secrets.DOCKERHUB_USER }}
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Build Native OCI Image
run: gradle bootBuildImage --publishImage --imagePlatform linux/amd64
env:
LANG: "en_US.UTF-8"
LC_ALL: "en_US.UTF-8"
NATIVE_IMAGE_OPTIONS: "-Dsun.jnu.encoding=UTF-8 -Dfile.encoding=UTF-8"
USERNAME: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DOCKERHUB_USER: ${{ secrets.DOCKERHUB_USER }}
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
TARGET_PLATFORM: "amd64"
- name: Setup QEMU for ARM64 OCI Image
uses: docker/setup-qemu-action@v3
env:
LANG: "en_US.UTF-8"
LC_ALL: "en_US.UTF-8"
with:
platforms: 'all'
- name: Set up Docker Buildx for ARM64 OCI Image
uses: docker/setup-buildx-action@v3
with:
install: true
platforms: 'linux/amd64,linux/arm64'
- name: Build Native ARM64 OCI Image
run: gradle bootBuildImage --publishImage --imagePlatform linux/arm64
env:
LANG: "en_US.UTF-8"
LC_ALL: "en_US.UTF-8"
USERNAME: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DOCKERHUB_USER: ${{ secrets.DOCKERHUB_USER }}
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
TARGET_PLATFORM: "arm64"
- name: Combine native images into single manifest
uses: int128/docker-manifest-create-action@v2
with:
push: true
tags: |
ghcr.io/schaka/janitorr:native-${{ steps.branch_name.outputs.value }}
${{ (startsWith(github.ref, 'refs/tags/v') && 'ghcr.io/schaka/janitorr:native-stable') || '' }}
sources: |
ghcr.io/schaka/janitorr:native-amd64-${{ steps.branch_name.outputs.value }}
ghcr.io/schaka/janitorr:native-arm64-${{ steps.branch_name.outputs.value }}