Skip to content

Publish Docker images #310

Publish Docker images

Publish Docker images #310

Workflow file for this run

name: Publish Docker images
on:
push:
branches: [ master ]
schedule:
- cron: '0 0 * * 0'
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
version: [3.2, 4.6]
jdk: [8, 11]
env:
repo: "govpf/sonar-scanner"
steps:
- name: Checkout
uses: actions/[email protected]
- name: Set up Docker Buildx
uses: docker/[email protected]
- name: Login to DockerHub
uses: docker/[email protected]
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Compute tags
env:
repo: ${{ env.repo }}
version: ${{ matrix.version }}
jdk: ${{ matrix.jdk }}
run: |
TAGS="${repo}:${version}-jdk-${jdk}"
if [[ $jdk == '8' ]]; then
TAGS+=",${repo}:${version}"
fi
echo 'docker_tags<<EOF' >> $GITHUB_ENV
echo "$TAGS" >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
- name: Build and push
uses: docker/[email protected]
with:
context: .
file: ./${{ matrix.version }}/jdk-${{ matrix.jdk }}/Dockerfile
platforms: linux/amd64
pull: true
push: true
tags: ${{ env.docker_tags }}
- name: Update repo description
uses: peter-evans/[email protected]
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
repository: "${{ env.repo }}"