Docker Build #56
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: Docker Build | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'Presto version to build' | |
required: true | |
type: string | |
latest: | |
description: 'Whether to tag the version as latest' | |
default: false | |
required: false | |
type: boolean | |
permissions: | |
contents: read | |
packages: write | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- run: echo "Building prestodb-sandbox=${{ inputs.version }}, latest=${{ inputs.latest }}" | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set build properties | |
id: properties | |
run: | | |
version=${{ inputs.version }} | |
if [ ${version} = "0.281" ] || [ "${version}" = "0.280" ]; then | |
platform="linux/amd64" | |
else | |
platform="linux/amd64,linux/arm64" | |
fi | |
echo "platforms=${platform}" | |
echo "platforms=${platform}" >> $GITHUB_OUTPUT | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ghcr.io/popsql/prestodb-sandbox | |
tags: | | |
type=raw,value=${{ inputs.version }} | |
type=raw,value=latest,enable=${{ inputs.latest == true }} | |
- 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.repository_owner }} | |
password: ${{ secrets.GH_PAT }} | |
- name: Build and push | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
platforms: ${{ steps.properties.outputs.platforms }} | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
build-args: | | |
PRESTO_VERSION=${{ inputs.version }} |