Repo Init #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build PolarisServer with PostgreSQL | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- "docker/**" | |
- ".github/workflows/polaris-server-image.yml" | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Checkout Polaris | |
uses: actions/checkout@v4 | |
with: | |
repository: apache/polaris | |
path: polaris | |
- name: Prepare repository name | |
id: repo | |
run: | | |
REPO_LOWER=$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]') | |
echo "lowercase=$REPO_LOWER" >> $GITHUB_OUTPUT | |
- name: Set up JDK 21 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: "21" | |
distribution: "temurin" | |
cache: gradle | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: | |
ghcr.io/${{ | |
steps.repo.outputs.lowercase}}/apache-polaris-server-pgsql | |
tags: | | |
type=raw,value=latest | |
type=sha | |
type=ref,event=branch | |
type=ref,event=tag | |
- name: Process tags for Quarkus | |
id: tags | |
run: | | |
# Convert metadata tags to comma-separated list | |
TAGS=$(echo "${{ steps.meta.outputs.tags }}" | tr '\n' ',' | sed 's/,$//') | |
# Remove the registry prefix from each tag | |
CLEAN_TAGS=$(echo $TAGS | sed "s|ghcr.io/${{ steps.repo.outputs.lowercase }}/apache-polaris-server-pgsql:||g") | |
echo "tags=$CLEAN_TAGS" >> $GITHUB_OUTPUT | |
- name: Build with Gradle and Create Docker Image | |
working-directory: ./polaris | |
env: | |
ECLIPSE_LINK_DEPS: "org.postgresql:postgresql:42.7.4" # Add if needed | |
IMAGE_REGISTRY: ghcr.io | |
run: | | |
./gradlew clean :polaris-quarkus-server:build \ | |
-PeclipseLinkDeps=${ECLIPSE_LINK_DEPS} \ | |
-Dquarkus.container-image.build=true \ | |
-Dquarkus.container-image.group= \ | |
-Dquarkus.container-image.name=${{ steps.repo.outputs.lowercase }}/apache-polaris-server-pgsql \ | |
-Dquarkus.container-image.tag=latest \ | |
-Dquarkus.container-image.additional-tags=${{ steps.tags.outputs.tags }} \ | |
-Dquarkus.container-image.push=true \ | |
-Dquarkus.container-image.registry=${IMAGE_REGISTRY} \ | |
-Dquarkus.container-image.builder=docker \ | |
-Dquarkus.container-image.platforms=linux/amd64,linux/arm64 \ | |
-Dquarkus.jib.platforms=linux/amd64,linux/arm64 |