Skip to content

Build and Publish Docker Images #3

Build and Publish Docker Images

Build and Publish Docker Images #3

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 }}/gas-station
STREAMR_DEST_IMAGE_NAME: ${{ github.repository }}/streamr-destination
jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- 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: .
build-args: path=sources/gas-station
push: true
tags: ${{ steps.meta-gas.outputs.tags }}
labels: ${{ steps.meta-gas.outputs.labels }}
- name: Build and push Streamr Destination image
uses: docker/build-push-action@v5
with:
context: .
build-args: path=destinations/streamr-destination
push: true
tags: ${{ steps.meta-streamr.outputs.tags }}
labels: ${{ steps.meta-streamr.outputs.labels }}