Files
brewery/.github/workflows/build.yaml
T

41 lines
1.2 KiB
YAML

name: Build and deploy containers
# Pushes to main will build containers with staging env's and push them as staging images, whereas release goes to production.
on:
release:
types: [published]
push:
branches:
- main
env:
IMAGE_NAME: ${{ github.event_name == 'release' && 'brewery' || 'brewery-staging' }}
jobs:
build_brewery:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Extract Docker image metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ vars.DOCKER_USERNAME }}/${{ env.IMAGE_NAME }}
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ vars.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push Docker image (server)
uses: docker/build-push-action@v6
with:
context: "{{defaultContext}}"
target: server
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
annotations: ${{ steps.meta.outputs.annotations }}