Skip to content

Merge pull request #279 from jacomago/zipcachedfetchtest-improve #7

Merge pull request #279 from jacomago/zipcachedfetchtest-improve

Merge pull request #279 from jacomago/zipcachedfetchtest-improve #7

# 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.
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle
name: Build and Push
on:
push:
branches: [ "master" ]
tags:
- '**'
permissions:
contents: read
checks: write
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build-jar-release:
name: Build Default site version
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Build with Gradle
run: ./gradlew assemble
env:
ARCHAPPL_SITEID: "default"
- name: Upload package
if: always()
uses: actions/upload-artifact@v4
with:
name: default-package
path: build/distributions/*.tar.gz
build-and-push-image:
permissions:
contents: read
packages: write
runs-on: ubuntu-latest
strategy:
matrix:
imagetag:
- singletomcat
- mgmt
- etl
- engine
- retrieval
steps:
- uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Build with Gradle
run: ./gradlew assemble
env:
ARCHAPPL_SITEID: "default"
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
flavor: |
latest=false
prefix=${{matrix.imagetag}}-
tags: |
type=ref,event=pr,prefix=${{ matrix.imagetag }}-pr-
type=sha,prefix=${{ matrix.imagetag }}-
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile
push: true
platforms: linux/amd64,linux/arm64
target: ${{matrix.imagetag}}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max