Skip to content

Publish Dependency Image #2

Publish Dependency Image

Publish Dependency Image #2

name: Publish Dependency Image
on:
workflow_dispatch:
inputs:
os_type:
description: 'Operating System'
required: true
default: 'ubuntu'
type: choice
options:
- centos
- ubuntu
architecture:
description: 'Architecture'
required: true
default: 'amd64'
type: choice
options:
- arm64
- amd64
tag_suffix:
description: 'Additional tag suffix (optional)'
required: false
type: string
env:
ORG: ${{ github.repository_owner }}
ARCH: ${{ inputs.architecture }}
jobs:
build-and-push:
name: Build and Push Dependency Image
runs-on: ${{ inputs.architecture == 'arm64' && 'ubuntu-24.04-arm' || 'ubuntu-latest' }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
path: presto-dev
- name: Checkout presto-native-execution
uses: actions/checkout@v4
with:
repository: prestodb/presto-native-execution
path: presto-native-execution
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ github.repository_owner }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Get version information
id: version
run: |
cd presto-native-execution
VERSION=$(grep -m 1 '^ <version>' pom.xml | sed -e 's/.*<version>\([^<]*\)<\/version>.*/\1/' -e 's/-SNAPSHOT//')
COMMIT_ID=$(git rev-parse --short HEAD)
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
echo "COMMIT_ID=$COMMIT_ID" >> $GITHUB_OUTPUT
echo "TIMESTAMP=$(date '+%Y%m%d%H%M%S')" >> $GITHUB_OUTPUT
- name: Apply Velox script patch (if exists)
run: |
cd presto-native-execution
make submodules
if [ -f "../presto-dev/scripts/velox-script.patch" ]; then
(cd velox && git stash && patch -p1 < "../../presto-dev/scripts/velox-script.patch")
fi
- name: Build dependency image
run: |
cd presto-dev
make ${{ inputs.os_type }}-dep
- name: Tag and push images
run: |
cd presto-dev
# Define image names
DEP_IMAGE="docker.io/${{ env.ORG }}/prestissimo-dependency:${{ inputs.os_type == 'ubuntu' && 'ubuntu-22.04' || 'centos9' }}"
VERSION_TAG="${DEP_IMAGE}-${{ steps.version.outputs.VERSION }}-${{ steps.version.outputs.COMMIT_ID }}-${{ inputs.architecture }}"
LATEST_TAG="${DEP_IMAGE}-latest-${{ inputs.architecture }}"
# Add custom tag if provided
if [ -n "${{ inputs.tag_suffix }}" ]; then
CUSTOM_TAG="${DEP_IMAGE}-${{ inputs.tag_suffix }}-${{ inputs.architecture }}"
docker tag "presto/prestissimo-dependency:${{ inputs.os_type == 'ubuntu' && 'ubuntu-22.04' || 'centos9' }}" "${CUSTOM_TAG}"
docker push "${CUSTOM_TAG}"
echo "Pushed custom tag: ${CUSTOM_TAG}"
fi
# Tag with version and latest
docker tag "presto/prestissimo-dependency:${{ inputs.os_type == 'ubuntu' && 'ubuntu-22.04' || 'centos9' }}" "${VERSION_TAG}"
docker tag "presto/prestissimo-dependency:${{ inputs.os_type == 'ubuntu' && 'ubuntu-22.04' || 'centos9' }}" "${LATEST_TAG}"
# Push images
docker push "${VERSION_TAG}"
docker push "${LATEST_TAG}"
echo "Pushed version tag: ${VERSION_TAG}"
echo "Pushed latest tag: ${LATEST_TAG}"