2/add GitHub actions for deployment to ghcr #3
Workflow file for this run
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: 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 }}/. | |
push: true | |
tags: synapsestudios/${{ 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 synapsestudios/${{ steps.set_image_name.outputs.image_name }}:latest |