Merge pull request #28 from siemens/dependabot/github_actions/docker/… #8
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
# SPDX-FileCopyrightText: © 2021 Siemens AG | |
# SPDX-FileCopyrightText: © Gaurav Mishra <[email protected]> | |
# SPDX-License-Identifier: GPL-2.0-only AND LGPL-2.1-only | |
name: Docker images - master | |
concurrency: | |
group: docker-${{ github.head_ref }} | |
cancel-in-progress: true | |
on: | |
push: | |
branches: | |
- master | |
release: | |
types: | |
- published | |
workflow_dispatch: | |
jobs: | |
docker-build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to DockerHub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Set build version | |
run: | | |
VERSION_PATTERN='([[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+)(-?rc[[:digit:]]+)?-?([[:digit:]]*)-?[[:alnum:]]*' | |
echo VERSION=$(git describe --tags > /dev/null 2>&1 && git describe --tags | head -1 | sed -re "s/${VERSION_PATTERN}/\\1.\\3\\2/" | sed -re 's/\.$/.0/') >> $GITHUB_ENV | |
- name: Build and push main image | |
uses: docker/build-push-action@v3 | |
with: | |
push: true | |
tags: fossology/fossology:latest | |
context: . | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
labels: | | |
org.opencontainers.image.version=${VERSION} | |
- name: Build and push runner image | |
uses: docker/build-push-action@v3 | |
with: | |
push: true | |
tags: fossology/fossology:scanner | |
file: utils/automation/Dockerfile.ci | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
labels: | | |
org.opencontainers.image.version=${VERSION} |