Skip to content
Latchkey

Docker Release workflow (ryanlelek/Raneto)

The Docker Release workflow from ryanlelek/Raneto, explained and optimized by Latchkey.

C

CI health: C - fair

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

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

What it does

This is the Docker Release workflow from the ryanlelek/Raneto 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)
---
# https://github.blog/changelog/2020-07-06-github-actions-manual-triggers-with-workflow_dispatch/

name: Docker Release
on:
  push:
    tags:
      - '*'
  workflow_dispatch:
    inputs:
      version:
        description: 'Release Version'
        required: true
        default: 'latest'

permissions:
  contents: read

jobs:
  build:
    runs-on: ubuntu-latest
    environment: Docker

    steps:
      # https://github.com/marketplace/actions/checkout
      # - name: Build the Docker image
      #   uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
      #   run: docker build . --file Dockerfile --tag raneto/raneto:latest-$(date +%s)

      # https://github.com/marketplace/actions/docker-setup-qemu
      - name: Set up QEMU
        uses: docker/setup-qemu-action@ce360397dd3f832beb865e1373c09c0e9f86d70a # v4.0.0

      # https://github.com/marketplace/actions/docker-setup-buildx
      - name: Set up Docker Buildx
        uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0

      # https://github.com/marketplace/actions/docker-login
      # https://github.com/docker/login-action
      - name: Login to Docker Hub
        uses: docker/login-action@b45d80f862d83dbcd57f89517bcf500b2ab88fb2 # v4.0.0
        with:
          username: ${{ secrets.DOCKER_USERNAME }}
          password: ${{ secrets.DOCKER_TOKEN }}

      # https://github.com/marketplace/actions/build-and-push-docker-images
      # https://docs.github.com/en/actions/publishing-packages/publishing-docker-images
      - name: Build and push "version"
        uses: docker/build-push-action@d08e5c354a6adb9ed34480a06d141179aa583294 # v7.0.0
        with:
          #context: .
          platforms: linux/amd64,linux/arm64
          push: true
          tags: |
            raneto/raneto:${{ github.event.inputs.version || github.ref_name }}
            raneto/raneto:latest

The same workflow, on Latchkey

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

---
# https://github.blog/changelog/2020-07-06-github-actions-manual-triggers-with-workflow_dispatch/
 
name: Docker Release
on:
  push:
    tags:
      - '*'
  workflow_dispatch:
    inputs:
      version:
        description: 'Release Version'
        required: true
        default: 'latest'
 
permissions:
  contents: read
 
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  build:
    timeout-minutes: 30
    runs-on: latchkey-small
    environment: Docker
 
    steps:
      # https://github.com/marketplace/actions/checkout
      # - name: Build the Docker image
      #   uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
      #   run: docker build . --file Dockerfile --tag raneto/raneto:latest-$(date +%s)
 
      # https://github.com/marketplace/actions/docker-setup-qemu
      - name: Set up QEMU
        uses: docker/setup-qemu-action@ce360397dd3f832beb865e1373c09c0e9f86d70a # v4.0.0
 
      # https://github.com/marketplace/actions/docker-setup-buildx
      - name: Set up Docker Buildx
        uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
 
      # https://github.com/marketplace/actions/docker-login
      # https://github.com/docker/login-action
      - name: Login to Docker Hub
        uses: docker/login-action@b45d80f862d83dbcd57f89517bcf500b2ab88fb2 # v4.0.0
        with:
          username: ${{ secrets.DOCKER_USERNAME }}
          password: ${{ secrets.DOCKER_TOKEN }}
 
      # https://github.com/marketplace/actions/build-and-push-docker-images
      # https://docs.github.com/en/actions/publishing-packages/publishing-docker-images
      - name: Build and push "version"
        uses: docker/build-push-action@d08e5c354a6adb9ed34480a06d141179aa583294 # v7.0.0
        with:
          #context: .
          platforms: linux/amd64,linux/arm64
          push: true
          tags: |
            raneto/raneto:${{ github.event.inputs.version || github.ref_name }}
            raneto/raneto:latest
 

What changed

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