Updating version oai [2024.w44 -> 2024.w45] (#298) #196
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
--- | |
name: Push Images | |
on: | |
push: | |
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: Login to DockerHub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- | |
name: Build and push | |
uses: docker/build-push-action@v3 | |
with: | |
context: ./images/${{ steps.image-info.outputs.image }}/ | |
push: true | |
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: true | |
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 |