From 092ac5c65e688a3c988e60c609c9069d862a1bc5 Mon Sep 17 00:00:00 2001 From: Brian Rosner Date: Sun, 19 May 2024 16:52:04 -0600 Subject: [PATCH] add build and push --- .github/workflows/ci.yml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6741f61..ef23fd9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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