add build and push

This commit is contained in:
Brian Rosner 2024-05-19 16:52:04 -06:00
parent 456bbfa630
commit 092ac5c65e

View File

@ -53,3 +53,33 @@ jobs:
with:
image: ${{ env.IMAGE_NAME }}:ci
run: pytest
build:
name: Build and push image
runs-on: ubuntu-latest
steps:
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Generate metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=sha
- name: Build image
uses: docker/build-push-action@v5
if: github.ref == 'refs/heads/main'
with:
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
target: prod
load: true
cache-from: type=gha
cache-to: type=gha,mode=max
push: true