Skip to content

[openvpn] Update Version 2.6.11 -> #411

[openvpn] Update Version 2.6.11 ->

[openvpn] Update Version 2.6.11 -> #411

Workflow file for this run

name: build images
on:
pull_request:
branches:
- main
paths:
- 'images/**'
- '!images/**/update_current_tag.sh'
env:
images_dir: images
jobs:
# Generate the values for images with changes
generate-matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.generate-matrix.outputs.matrix }}
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- id: files
uses: tj-actions/[email protected]
- name: Generate Matrix Content
id: generate-matrix
run: |
changed=`echo "${{ steps.files.outputs.all_changed_files }}" | sed 's/ /\n/g' | grep $images_dir | cut -f2 -d'/' | uniq | sed 's/^/"/;s/$/"/' | sed -z 's/\n/,/g;s/,$/\n/'`
echo "matrix={ \"image\": [ ${changed} ] }" >> $GITHUB_OUTPUT
# build image if changes in code
build-image:
needs: generate-matrix
runs-on: ubuntu-latest
strategy:
matrix: ${{ fromJson( needs.generate-matrix.outputs.matrix ) }}
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Get Image Info
id: image-info
run: |
source ./images/${{ matrix.image }}/image_info.sh
echo "platforms=$PLATFORMS" >> $GITHUB_OUTPUT
echo "image_tag=$IMAGE_TAG" >> $GITHUB_OUTPUT
echo "image=${{ matrix.image }}" >> $GITHUB_OUTPUT
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
-
name: Build and push
uses: docker/build-push-action@v3
with:
context: ./images/${{ steps.image-info.outputs.image }}/
push: false
tags: gradiant/${{ steps.image-info.outputs.image }}:${{ steps.image-info.outputs.image_tag }}
build-args: version=${{ steps.image-info.outputs.image_tag }}
platforms: ${{ steps.image-info.outputs.platforms }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Check for ubi Dockerfile
id: ubi_dockerfile
run: |
if test -f "images/${{ matrix.image }}/Dockerfile.ubi"; then
echo "build_ubi=true" >> $GITHUB_OUTPUT
else
echo "build_ubi=false" >> $GITHUB_OUTPUT
fi
- name: Login to RedHat Registry
if: steps.ubi_dockerfile.outputs.build_ubi == 'true'
uses: docker/login-action@v2
with:
registry: registry.redhat.io
username: ${{ secrets.REDHAT_USERNAME }}
password: ${{ secrets.REDHAT_PASSWORD }}
- name: Build and push
if: steps.ubi_dockerfile.outputs.build_ubi == 'true'
uses: docker/build-push-action@v3
with:
context: ./images/${{ steps.image-info.outputs.image }}/
file: ./images/${{ steps.image-info.outputs.image }}/Dockerfile.ubi
push: false
tags: gradiant/${{ steps.image-info.outputs.image }}:${{ steps.image-info.outputs.image_tag }}-ubi
build-args: version=${{ steps.image-info.outputs.image_tag }}
platforms: ${{ steps.image-info.outputs.platforms }}
cache-from: type=gha
cache-to: type=gha,mode=max