Skip to content
Latchkey

Build & Push SwaggerUI unstable Docker image workflow (swagger-api/swagger-ui)

The Build & Push SwaggerUI unstable Docker image workflow from swagger-api/swagger-ui, explained and optimized by Latchkey.

B

CI health: B - good

Point runs-on at Latchkey and get 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: swagger-api/swagger-ui.github/workflows/docker-build-push-unstable.ymlLicense Apache-2.0View source

What it does

This is the Build & Push SwaggerUI unstable Docker image workflow from the swagger-api/swagger-ui repository, a real project running GitHub Actions. It is shown here with attribution under its Apache-2.0 license.

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

The workflow

workflow (.yml)
name: Build & Push SwaggerUI unstable Docker image

on:
  workflow_run:
    workflows: ["Node.js CI"]
    types:
      - completed
    branches: [master]

jobs:

  build-push-unstable:
    if: github.event.workflow_run.conclusion == 'success'
    name: Build & Push SwaggerUI unstable Docker image
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v7

      - name: Use Node.js
        uses: actions/setup-node@v6
        with:
          node-version-file: .nvmrc
          cache: npm
          cache-dependency-path: package-lock.json

      - name: Install dependencies
        run: npm ci

      - name: Build SwaggerUI
        run: npm run build

      - name: Set up QEMU
        uses: docker/setup-qemu-action@v4

      - name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v4

      - name: Log in to DockerHub
        uses: docker/login-action@v4
        with:
          username: ${{ secrets.DOCKERHUB_SB_USERNAME }}
          password: ${{ secrets.DOCKERHUB_SB_PASSWORD }}

      - name: Build docker image and push
        uses: docker/build-push-action@v7
        with:
          context: .
          push: true
          platforms: linux/amd64,linux/arm/v6,linux/arm64,linux/386,linux/ppc64le
          provenance: false
          tags: swaggerapi/swagger-ui:unstable

The same workflow, on Latchkey

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

name: Build & Push SwaggerUI unstable Docker image
 
on:
  workflow_run:
    workflows: ["Node.js CI"]
    types:
      - completed
    branches: [master]
 
jobs:
 
  build-push-unstable:
    timeout-minutes: 30
    if: github.event.workflow_run.conclusion == 'success'
    name: Build & Push SwaggerUI unstable Docker image
    runs-on: latchkey-small
 
    steps:
      - uses: actions/checkout@v7
 
      - name: Use Node.js
        uses: actions/setup-node@v6
        with:
          node-version-file: .nvmrc
          cache: npm
          cache-dependency-path: package-lock.json
 
      - name: Install dependencies
        run: npm ci
 
      - name: Build SwaggerUI
        run: npm run build
 
      - name: Set up QEMU
        uses: docker/setup-qemu-action@v4
 
      - name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v4
 
      - name: Log in to DockerHub
        uses: docker/login-action@v4
        with:
          username: ${{ secrets.DOCKERHUB_SB_USERNAME }}
          password: ${{ secrets.DOCKERHUB_SB_PASSWORD }}
 
      - name: Build docker image and push
        uses: docker/build-push-action@v7
        with:
          context: .
          push: true
          platforms: linux/amd64,linux/arm/v6,linux/arm64,linux/386,linux/ppc64le
          provenance: false
          tags: swaggerapi/swagger-ui:unstable
 

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