Let's make atils-avp handle arch a bit better (#133) #2
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: Custom Images CI | |
on: | |
push: | |
branches: | |
- master | |
paths: | |
- 'custom-images/**' | |
- '.github/workflows/custom-containers-run-ci.yaml' | |
- '!custom-images/docs/**' | |
jobs: | |
generate-matrix: | |
runs-on: ubuntu-latest | |
outputs: | |
changed_directories: ${{ steps.set-output.outputs.changed_directories }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Get changed files | |
id: changed-files | |
uses: tj-actions/[email protected] | |
with: | |
dir_names: true | |
json: true | |
quotepath: false | |
dir_names_exclude_current_dir: true | |
files: | | |
custom-images/** | |
!custom-images/docs/** | |
- name: 'Set output in the matrix format' | |
id: set-output | |
run: echo "changed_directories={\"dir\":${{ steps.changed-files.outputs.all_changed_files }}}" >> "$GITHUB_OUTPUT" | |
build-and-publish: | |
runs-on: ubuntu-latest | |
if: ${{ needs.generate-matrix.outputs.changed_directories != '' }} | |
strategy: | |
matrix: ${{ fromJson(needs.generate-matrix.outputs.changed_directories) }} | |
needs: | |
- generate-matrix | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Get image repo | |
run: | | |
source ${{ matrix.dir }}/config.env | |
echo "REPO=$IMAGE_NAME" >> $GITHUB_ENV | |
- name: Get image tag | |
run: | | |
source ${{ matrix.dir }}/config.env | |
echo "TAG=$IMAGE_TAG" >> $GITHUB_ENV | |
- name: Get image directory basename | |
run: | | |
NAME=$(basename ${{ matrix.dir }}) | |
echo "NAME=$NAME" >> $GITHUB_ENV | |
- name: Setup QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and publish custom image | |
uses: docker/build-push-action@v6 | |
with: | |
push: true | |
file: custom-images/${{ env.NAME }}/Dockerfile | |
context: custom-images/${{ env.NAME }} | |
tags: | | |
${{ env.REPO }}:${{ env.TAG }} | |
${{ env.REPO }}:latest | |
platforms: linux/amd64, linux/arm64 |