Skip to content

2/add GitHub actions for deployment to ghcr #5

2/add GitHub actions for deployment to ghcr

2/add GitHub actions for deployment to ghcr #5

Workflow file for this run

name: PR Build
on:
pull_request:
branches:
- main
jobs:
create_matrix:
uses: ./.github/workflows/create_matrix.yml
with:
image_directory: "./images"
build:
runs-on: ubuntu-latest
needs: create_matrix
strategy:
matrix:
image_folder: ${{fromJson(needs.create_matrix.outputs.matrix)}}
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set Image Name output
run: echo "image_name=$(python3 -c "print('${{ matrix.image_folder }}'.split('/')[-1])")" >> $GITHUB_OUTPUT
id: set_image_name
- name: Set up Docker
uses: docker/setup-buildx-action@v3
- name: Build and push to GHA
uses: docker/build-push-action@v5
with:
context: ${{ matrix.image_folder }}/.
tags: ${{ steps.set_image_name.outputs.image_name }}:latest
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Check build status
run: docker run --rm ${{ steps.set_image_name.outputs.image_name }}:latest