Skip to content

Build and Publish Docker Images #4

Build and Publish Docker Images

Build and Publish Docker Images #4

name: Build and Publish Docker Images
on:
workflow_dispatch:
push:
branches:
- main
tags:
- 'v*'
release:
types: [published]
env:
REGISTRY: ghcr.io
GAS_STATION_IMAGE_NAME: ${{ github.repository }}/airbyte-gas-station
STREAMR_DEST_IMAGE_NAME: ${{ github.repository }}/airbyte-streamr-destination
jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
platforms: linux/amd64
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Gas Station
id: meta-gas
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.GAS_STATION_IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=sha
- name: Extract metadata (tags, labels) for Streamr Destination
id: meta-streamr
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.STREAMR_DEST_IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=sha
- name: Build and push Gas Station image
uses: docker/build-push-action@v5
with:
context: .
push: true
build-args: path=sources/gas-station
tags: ${{ steps.meta-gas.outputs.tags }}
labels: ${{ steps.meta-gas.outputs.labels }}
cache-from: type=gha,scope=gas-station
cache-to: type=gha,mode=max,scope=gas-station
- name: Build and push Streamr Destination image
uses: docker/build-push-action@v5
with:
context: .
push: true
build-args: path=destinations/streamr-destination
tags: ${{ steps.meta-streamr.outputs.tags }}
labels: ${{ steps.meta-streamr.outputs.labels }}
cache-from: type=gha,scope=streamr-destination
cache-to: type=gha,mode=max,scope=streamr-destination