teufa/.github/workflows/build.yml
2024-05-19 09:29:05 -06:00

47 lines
1.1 KiB
YAML

name: Build
on:
workflow_run:
workflows: [Tests]
types:
- completed
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: log in to ghcr.io
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: docker meta
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 prod image
uses: docker/build-push-action@v5
if: github.ref == 'refs/heads/main'
with:
context: .
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