Skip to content

Build and publish Docker image #462

Build and publish Docker image

Build and publish Docker image #462

name: Build and publish Docker image
on:
workflow_dispatch:
inputs:
image_type:
description: "Choose which image to build (publisher/webserver/both)"
required: true
type: choice
options:
- publisher
- webserver
- both
default: "both"
push:
branches:
- main
release:
types:
- published
permissions:
contents: read
packages: write
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
build-and-publish-image:
runs-on: ubuntu-latest
if: |
(github.event_name == 'release' && github.event.action == 'published') ||
github.ref == 'refs/heads/main' ||
github.event_name == 'workflow_dispatch' ||
github.event_name == 'pull_request'
steps:
- uses: actions/checkout@v4
- name: Get short SHA
id: sha
run: echo "short_sha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Build and push Docker for publisher
if: github.event.inputs.image_type == 'publisher' || github.event.inputs.image_type == 'both'
|| github.event_name != 'workflow_dispatch'
uses: ./.github/actions/docker-publish
id: publish-fuel-streams-nats
with:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
image: ghcr.io/fuellabs/fuel-streams-publisher
dockerfile: cluster/docker/fuel-streams-publisher.Dockerfile
- name: Build and push Docker for webserver
if: github.event.inputs.image_type == 'webserver' || github.event.inputs.image_type == 'both'
|| github.event_name != 'workflow_dispatch'
uses: ./.github/actions/docker-publish
id: publish-fuel-webserver-nats
with:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
image: ghcr.io/fuellabs/fuel-streams-ws
dockerfile: cluster/docker/fuel-streams-ws.Dockerfile