2022-10-24 23:24:41 +02:00
|
|
|
name: Build
|
2019-12-29 16:32:35 +01:00
|
|
|
|
2022-08-14 22:33:40 +02:00
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- "*"
|
|
|
|
tags:
|
|
|
|
- "*"
|
|
|
|
pull_request:
|
|
|
|
branches:
|
|
|
|
- "*"
|
2023-09-27 23:14:46 +02:00
|
|
|
workflow_dispatch:
|
2019-12-29 16:32:35 +01:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2024-06-14 00:40:11 +02:00
|
|
|
- uses: actions/checkout@v4
|
2022-08-14 22:33:40 +02:00
|
|
|
with:
|
|
|
|
submodules: recursive
|
|
|
|
fetch-depth: 0 # needed for versioning
|
2023-09-27 23:09:53 +02:00
|
|
|
- name: Set up Java
|
2024-06-14 00:40:11 +02:00
|
|
|
uses: actions/setup-java@v4
|
2022-08-14 22:33:40 +02:00
|
|
|
with:
|
2023-09-27 23:09:53 +02:00
|
|
|
distribution: 'temurin'
|
2024-09-12 17:45:21 +02:00
|
|
|
java-version: 21
|
2023-09-27 23:09:53 +02:00
|
|
|
cache: 'gradle'
|
2022-08-14 22:33:40 +02:00
|
|
|
- name: Build with Gradle
|
2024-09-12 17:45:21 +02:00
|
|
|
run: ./gradlew spotlessCheck test release --stacktrace
|
2024-06-14 00:40:11 +02:00
|
|
|
- uses: actions/upload-artifact@v4
|
2022-08-14 22:33:40 +02:00
|
|
|
with:
|
|
|
|
name: artifacts
|
|
|
|
path: build/release/*
|
|
|
|
|
|
|
|
docker:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs: build
|
|
|
|
steps:
|
2024-06-14 01:15:12 +02:00
|
|
|
- uses: actions/checkout@v4
|
2022-08-14 22:33:40 +02:00
|
|
|
with:
|
|
|
|
submodules: recursive
|
|
|
|
fetch-depth: 0
|
2024-06-14 01:15:12 +02:00
|
|
|
- uses: actions/download-artifact@v4
|
2022-08-14 22:33:40 +02:00
|
|
|
with:
|
|
|
|
name: artifacts
|
|
|
|
path: build/release
|
|
|
|
- name: Login to GitHub Container Registry
|
2024-06-14 00:40:11 +02:00
|
|
|
uses: docker/login-action@v3
|
2022-08-14 22:33:40 +02:00
|
|
|
with:
|
|
|
|
registry: ghcr.io
|
|
|
|
username: ${{ github.repository_owner }}
|
|
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Set up Docker Buildx
|
2024-06-14 00:40:11 +02:00
|
|
|
uses: docker/setup-buildx-action@v3
|
2022-08-14 22:33:40 +02:00
|
|
|
- name: Docker metadata
|
|
|
|
id: metadata
|
2024-06-14 00:40:11 +02:00
|
|
|
uses: docker/metadata-action@v5
|
2022-08-14 22:33:40 +02:00
|
|
|
with:
|
|
|
|
images: ghcr.io/${{ github.repository }}
|
2022-09-09 16:40:27 +02:00
|
|
|
# Always tagged as the pushed branch (ex. master)
|
|
|
|
# For releases: latest, full version and major version (ex. latest, v3.3 and v3)
|
2022-08-14 22:33:40 +02:00
|
|
|
tags: |
|
|
|
|
type=raw,value={{branch}}
|
2022-09-09 16:40:27 +02:00
|
|
|
type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/') }}
|
2022-08-14 22:33:40 +02:00
|
|
|
type=raw,value={{tag}},enable=${{ startsWith(github.ref, 'refs/tags/') }}
|
2022-09-09 16:40:27 +02:00
|
|
|
type=match,pattern=v\d+,group=0,enable=${{ startsWith(github.ref, 'refs/tags/') }}
|
2022-08-14 22:33:40 +02:00
|
|
|
flavor: |
|
|
|
|
latest=false
|
|
|
|
- name: Build and push
|
2024-06-14 00:40:11 +02:00
|
|
|
uses: docker/build-push-action@v5
|
2022-08-14 22:33:40 +02:00
|
|
|
with:
|
|
|
|
context: .
|
2023-05-15 17:01:44 +02:00
|
|
|
platforms: linux/amd64,linux/arm64
|
2022-08-14 22:33:40 +02:00
|
|
|
tags: ${{ steps.metadata.outputs.tags }}
|
|
|
|
labels: ${{ steps.metadata.outputs.labels }}
|
|
|
|
push: ${{ github.event_name != 'pull_request' }}
|
|
|
|
cache-from: type=gha
|
|
|
|
cache-to: type=gha,mode=max
|