Skip to content

Publish

Publish #4

Workflow file for this run

name: Publish
on:
workflow_dispatch:
inputs:
tag:
description: "Image tag"
required: true
default: "latest"
type: string
server-tag:
description: "Target image tag for sharinghub-server"
required: true
default: "latest"
type: string
ui-tag:
description: "Target image tag for sharinghub-ui"
required: true
default: "latest"
type: string
docs-tag:
description: "Target image tag for sharinghub-docs"
required: true
default: "latest"
type: string
push:
tags:
- "[0-9]+.[0-9]+.[0-9]+"
env:
IMAGE_NAME: ${{ github.event.repository.name }}
IMAGE_TAG: ${{ inputs.tag || github.ref_name }}
IMAGE_SERVER_TAG: ${{ inputs.server-tag || github.ref_name }}
IMAGE_UI_TAG: ${{ inputs.ui-tag || github.ref_name }}
IMAGE_DOCS_TAG: ${{ inputs.docs-tag || github.ref_name }}
jobs:
docker-build-and-push:
name: Build and push docker image
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login with registry
uses: docker/login-action@v3
with:
registry: ${{ vars.IMAGE_REGISTRY }}
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ vars.IMAGE_REPOSITORY }}/${{ env.IMAGE_NAME }}
tags: |
# set image tag
type=raw,value=${{ env.IMAGE_TAG }}
- name: Build and push image
uses: docker/build-push-action@v6
with:
build-args: |
SERVER_IMAGE=${{ vars.IMAGE_REPOSITORY }}/sharinghub-server:${{ env.IMAGE_SERVER_TAG }}
WEB_UI_IMAGE=${{ vars.IMAGE_REPOSITORY }}/sharinghub-ui:${{ env.IMAGE_UI_TAG }}
DOCS_IMAGE=${{ vars.IMAGE_REPOSITORY }}/sharinghub-docs:${{ env.IMAGE_DOCS_TAG }}
tags: ${{ steps.meta.outputs.tags }}
annotations: ${{ steps.meta.outputs.annotations }}
provenance: mode=max
sbom: true
push: true