74 lines
2.4 KiB
YAML
74 lines
2.4 KiB
YAML
name: Publish Docker Images
|
|
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
JAVA_VERSION:
|
|
description: Java version to use
|
|
required: false
|
|
type: string
|
|
default: '17'
|
|
BRANCH_REFERENCE:
|
|
description: Branch reference
|
|
required: true
|
|
type: string
|
|
|
|
jobs:
|
|
publish-artifact:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 1
|
|
ref: ${{ inputs.BRANCH_REFERENCE }}
|
|
token: ${{ secrets.CI_BOT_TOKEN }}
|
|
- name: Set up JDK
|
|
uses: actions/setup-java@v4
|
|
with:
|
|
distribution: temurin
|
|
java-version: ${{ inputs.JAVA_VERSION }}
|
|
- name: Extract project information
|
|
id: project
|
|
run: |
|
|
NAME=$(awk -F '=' '/^rootProject\.name/{gsub(/[[:space:]]*/,"",$2); gsub(/"/,"",$2); print $2}' settings.gradle.kts)
|
|
if [ -z "$NAME" ]; then
|
|
echo "Error: No application name found in settings.gradle.kts" >&2
|
|
exit 1
|
|
fi
|
|
VERSION=$(awk -F '=' '/^version[[:space:]]*=/{gsub(/[[:space:]]*/,"",$2); print $2}' gradle.properties)
|
|
if [ -z "$VERSION" ]; then
|
|
echo "Error: No version found in gradle.properties" >&2
|
|
exit 1
|
|
fi
|
|
echo "name=$NAME" >> $GITHUB_OUTPUT
|
|
echo "Extracted application name: $NAME"
|
|
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
|
echo "Extracted application version: $VERSION"
|
|
- name: Build Docker Image
|
|
run: ./gradlew dockerBuildImage
|
|
env:
|
|
REPOSITORY_USER: ${{ secrets.CI_BOT_USERNAME }}
|
|
REPOSITORY_TOKEN: ${{ secrets.CI_BOT_TOKEN }}
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
with:
|
|
install: true
|
|
driver: docker-container
|
|
- name: Log in to Gitea Container Registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: gitea.lulz.ltd
|
|
username: ${{ secrets.CI_BOT_USERNAME }}
|
|
password: ${{ secrets.CI_BOT_TOKEN }}
|
|
- name: Build and push Docker image
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: ./build/docker/
|
|
platforms: linux/amd64
|
|
provenance: false
|
|
push: true
|
|
sbom: false
|
|
tags: |
|
|
gitea.lulz.ltd/aura-ascend/${{ steps.project.outputs.name }}:${{ steps.project.outputs.version }}
|