Skip to content

Publish Docker Image #13

Publish Docker Image

Publish Docker Image #13

Workflow file for this run

name: Publish Docker Image
on:
workflow_run:
workflows: [ "build" ]
types:
- completed
jobs:
build-and-publish:
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '11'
- name: Extract version from pom.xml
id: extract_version
run: |
VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: query-executor
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
file: ./Dockerfile
push: true
tags: "${{ secrets.DOCKER_USERNAME }}/c360-query-executor:${{ env.VERSION }}"