chore: Add GitHub workflow to publish Docker image #10
Workflow file for this run
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
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
name: Publish Docker images | ||
concurrency: | ||
group: ${{ github.repository }}-${{ github.head_ref || github.sha }}-${{ github.workflow }} | ||
cancel-in-progress: true | ||
on: | ||
push: | ||
tags: | ||
- '*.*.*' | ||
- '*.*.*-rc*' | ||
docker: | ||
name: Docker | ||
runs-on: ubuntu-22.04 | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Java | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '17' | ||
- name: Extract Maven version | ||
id: extract_version | ||
run: | | ||
COMET_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout) | ||
echo "COMET_VERSION=$COMET_VERSION" >> $GITHUB_ENV | ||
- name: Echo Maven version | ||
run: echo "The current Maven version is ${{ env.COMET_VERSION }}" | ||
- name: Build and push Docker image | ||
run: | | ||
docker build -t datafusion-comet:spark-3.4-scala-2.12-${{ env.COMET_VERSION }} -f kube/Dockerfile . | ||
export DOCKER_TAG="$(git describe --exact-match --tags $(git log -n1 --pretty='%h') || echo '')" | ||
echo "publishing docker tag $DOCKER_TAG" | ||
docker tag datafusion-comet:spark-3.4-scala-2.12t-${{ env.COMET_VERSION }} ghcr.io/apache/datafusion-comet:$DOCKER_TAG | ||
docker login ghcr.io -u $DOCKER_USER -p "$DOCKER_PASS" | ||
docker push ghcr.io/apache/datafusion-comet:$DOCKER_TAG | ||
env: | ||
DOCKER_USER: ${{ github.actor }} | ||
DOCKER_PASS: ${{ secrets.GITHUB_TOKEN }} |