Skip to content
Latchkey

Docker Release workflow (ohmjs/ohm)

The Docker Release workflow from ohmjs/ohm, explained and optimized by Latchkey.

C

CI health: C - fair

Point runs-on at Latchkey and get run de-duplication, job timeouts, SHA-pinned actions, self-healing for flaky steps, and up to 58% lower cost, applied automatically.

Grade your own workflow free or run it on Latchkey →
Source: ohmjs/ohm.github/workflows/docker-release.ymlLicense MITView source

What it does

This is the Docker Release workflow from the ohmjs/ohm repository, a real project running GitHub Actions. It is shown here with attribution under its MIT license.

Below, Latchkey shows a faster, safer version produced by its optimization engine.

The workflow

workflow (.yml)
name: Docker Release

# This workflow was largely generated from the following prompt:
#   "only run this on merge to main; clone the repo; set the VERSION environment
#   variable from packages/runtime/package.json; use `docker manifest inspect`
#   to verify the release doesn't already exist; create a multi-platform builder;
#   build and push the image"

on:
  push:
    branches: [main]

jobs:
  docker:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v4

      - name: Get version
        id: version
        run: |
          echo "VERSION=$(cat packages/runtime/package.json | jq -r '.version')" >> "$GITHUB_OUTPUT"

      - name: Check if image already exists
        id: check
        run: |
          if docker manifest inspect ohmjs/ohm:${{ steps.version.outputs.VERSION }} > /dev/null 2>&1; then
            echo "exists=true" >> "$GITHUB_OUTPUT"
          else
            echo "exists=false" >> "$GITHUB_OUTPUT"
          fi

      - name: Set up QEMU
        if: steps.check.outputs.exists == 'false'
        uses: docker/setup-qemu-action@v4

      - name: Set up Docker Buildx
        if: steps.check.outputs.exists == 'false'
        uses: docker/setup-buildx-action@v4

      - name: Log in to Docker Hub
        if: steps.check.outputs.exists == 'false'
        uses: docker/login-action@v4
        with:
          username: ${{ secrets.DOCKERHUB_USERNAME }}
          password: ${{ secrets.DOCKERHUB_TOKEN }}

      - name: Build and push
        if: steps.check.outputs.exists == 'false'
        uses: docker/bake-action@v7
        with:
          files: docker/docker-compose.yml
          push: true
        env:
          VERSION: ${{ steps.version.outputs.VERSION }}

The same workflow, on Latchkey

Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.

name: Docker Release
 
# This workflow was largely generated from the following prompt:
#   "only run this on merge to main; clone the repo; set the VERSION environment
#   variable from packages/runtime/package.json; use `docker manifest inspect`
#   to verify the release doesn't already exist; create a multi-platform builder;
#   build and push the image"
 
on:
  push:
    branches: [main]
 
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  docker:
    timeout-minutes: 30
    runs-on: latchkey-small
 
    steps:
      - uses: actions/checkout@v4
 
      - name: Get version
        id: version
        run: |
          echo "VERSION=$(cat packages/runtime/package.json | jq -r '.version')" >> "$GITHUB_OUTPUT"
 
      - name: Check if image already exists
        id: check
        run: |
          if docker manifest inspect ohmjs/ohm:${{ steps.version.outputs.VERSION }} > /dev/null 2>&1; then
            echo "exists=true" >> "$GITHUB_OUTPUT"
          else
            echo "exists=false" >> "$GITHUB_OUTPUT"
          fi
 
      - name: Set up QEMU
        if: steps.check.outputs.exists == 'false'
        uses: docker/setup-qemu-action@v4
 
      - name: Set up Docker Buildx
        if: steps.check.outputs.exists == 'false'
        uses: docker/setup-buildx-action@v4
 
      - name: Log in to Docker Hub
        if: steps.check.outputs.exists == 'false'
        uses: docker/login-action@v4
        with:
          username: ${{ secrets.DOCKERHUB_USERNAME }}
          password: ${{ secrets.DOCKERHUB_TOKEN }}
 
      - name: Build and push
        if: steps.check.outputs.exists == 'false'
        uses: docker/bake-action@v7
        with:
          files: docker/docker-compose.yml
          push: true
        env:
          VERSION: ${{ steps.version.outputs.VERSION }}
 

What changed

4 third-party actions are referenced by a movable tag. Pin them to the commit SHA (Latchkey resolves and applies this automatically) so a repointed tag cannot change what runs.

What Latchkey heals here

This workflow has steps that commonly fail on transient issues (network, registries, flaky browsers). On Latchkey managed runners they are detected, retried, and self-healed instead of failing your build:

This workflow runs 1 job per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.

Actions used in this workflow