Skip to content

Docker Release

Docker Release #19

Workflow file for this run

name: Docker Release
on:
push:
branches: [ "master" ]
workflow_dispatch:
inputs:
image_version:
description: 'Marketplace Docker image version'
required: true
default: 'latest'
env:
UI_IMAGE_NAME: marketplace-ui
SERVICE_IMAGE_NAME: marketplace-service
jobs:
build:
name: Build Docker images
uses: ./.github/workflows/docker-build.yml
release:
name: Tag and publish image to GH packages
needs: build
runs-on: self-hosted
permissions:
packages: write
contents: read
steps:
- name: Wait for containers to be up and running
working-directory: ./marketplace-build
run: |
# Wait for up to 300 seconds for the containers to be up
timeout=300
start_time=$(date +%s)
while [ $(($(date +%s) - start_time)) -lt $timeout ]; do
if docker compose ps | grep -q "Up"; then
echo "Containers are up and running."
exit 0
fi
echo "Waiting for containers to start..."
sleep 5
done
echo "Containers did not start within the timeout period."
exit 1
- name: Log in to registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Refine release version
run: |
# This strips the git ref prefix from the version.
VERSION=${{ github.event.inputs.image_version }}
# This uses the Docker `latest` tag convention.
[ "$VERSION" == "main" ] && VERSION=latest
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Release Marketplace UI image
run: |
UI_IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$UI_IMAGE_NAME
docker tag $UI_IMAGE_NAME $UI_IMAGE_ID:$VERSION
docker push $UI_IMAGE_ID:$VERSION
- name: Release Marketplace Service image
run: |
SERVICE_IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$SERVICE_IMAGE_NAME
docker tag $SERVICE_IMAGE_NAME $SERVICE_IMAGE_ID:$VERSION
docker push $SERVICE_IMAGE_ID:$VERSION