Skip to content
Latchkey

release workflow (netbox-community/netbox-docker)

The release workflow from netbox-community/netbox-docker, 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: netbox-community/netbox-docker.github/workflows/release.ymlLicense Apache-2.0View source

What it does

This is the release workflow from the netbox-community/netbox-docker 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: release

on:
  release:
    types:
      - published
  schedule:
    - cron: "45 5 * * *"
  workflow_dispatch:

jobs:
  build:
    strategy:
      matrix:
        build:
          - { "cmd": "./build-latest.sh", "branch": "release" }
          - { "cmd": "./build.sh main", "branch": "release" }
          # Build pre release images from our develop branch
          # This is used to test the latest changes before they are merged into the main branch
          - { "cmd": "PRERELEASE=true ./build-latest.sh", "branch": "develop" }
          - { "cmd": "./build.sh feature", "branch": "develop" }
        platform:
          - linux/amd64,linux/arm64
      fail-fast: false
    runs-on: ubuntu-24.04
    name: Builds new NetBox Docker Images
    env:
      GH_ACTION: enable
      GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      IMAGE_NAMES: docker.io/netboxcommunity/netbox quay.io/netboxcommunity/netbox ghcr.io/netbox-community/netbox
    steps:
      - id: source-checkout
        name: Checkout
        uses: actions/checkout@v6
        with:
          ref: ${{ matrix.build.branch }}
      - id: set-netbox-docker-version
        name: Get Version of NetBox Docker
        run: echo "version=$(cat VERSION)" >>"$GITHUB_OUTPUT"
        shell: bash
      - id: check-build-needed
        name: Check if the build is needed for '${{ matrix.build.cmd }}'
        env:
          CHECK_ONLY: "true"
        run: ${{ matrix.build.cmd }}
      # docker.io
      - id: docker-io-login
        name: Login to docker.io
        uses: docker/login-action@v4
        with:
          registry: docker.io
          username: ${{ secrets.dockerhub_username }}
          password: ${{ secrets.dockerhub_password }}
        if: steps.check-build-needed.outputs.skipped != 'true'
      - id: buildx-setup
        name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v4
        with:
          version: "lab:latest"
          driver: cloud
          endpoint: "netboxcommunity/netbox-default"
        if: steps.check-build-needed.outputs.skipped != 'true'
      # quay.io
      - id: quay-io-login
        name: Login to Quay.io
        uses: docker/login-action@v4
        with:
          registry: quay.io
          username: ${{ secrets.quayio_username }}
          password: ${{ secrets.quayio_password }}
        if: steps.check-build-needed.outputs.skipped != 'true'
      # ghcr.io
      - id: ghcr-io-login
        name: Login to GitHub Container Registry
        uses: docker/login-action@v4
        with:
          registry: ghcr.io
          username: ${{ github.repository_owner }}
          password: ${{ secrets.GITHUB_TOKEN }}
        if: steps.check-build-needed.outputs.skipped != 'true'
      - id: build-and-push
        name: Push the image
        run: ${{ matrix.build.cmd }} --push
        if: steps.check-build-needed.outputs.skipped != 'true'
        env:
          BUILDX_PLATFORM: ${{ matrix.platform }}
          BUILDX_BUILDER_NAME: ${{ steps.buildx-setup.outputs.name }}

The same workflow, on Latchkey

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

---
name: release
 
on:
  release:
    types:
      - published
  schedule:
    - cron: "45 5 * * *"
  workflow_dispatch:
 
jobs:
  build:
    timeout-minutes: 30
    strategy:
      matrix:
        build:
          - { "cmd": "./build-latest.sh", "branch": "release" }
          - { "cmd": "./build.sh main", "branch": "release" }
          # Build pre release images from our develop branch
          # This is used to test the latest changes before they are merged into the main branch
          - { "cmd": "PRERELEASE=true ./build-latest.sh", "branch": "develop" }
          - { "cmd": "./build.sh feature", "branch": "develop" }
        platform:
          - linux/amd64,linux/arm64
      fail-fast: false
    runs-on: latchkey-small
    name: Builds new NetBox Docker Images
    env:
      GH_ACTION: enable
      GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      IMAGE_NAMES: docker.io/netboxcommunity/netbox quay.io/netboxcommunity/netbox ghcr.io/netbox-community/netbox
    steps:
      - id: source-checkout
        name: Checkout
        uses: actions/checkout@v6
        with:
          ref: ${{ matrix.build.branch }}
      - id: set-netbox-docker-version
        name: Get Version of NetBox Docker
        run: echo "version=$(cat VERSION)" >>"$GITHUB_OUTPUT"
        shell: bash
      - id: check-build-needed
        name: Check if the build is needed for '${{ matrix.build.cmd }}'
        env:
          CHECK_ONLY: "true"
        run: ${{ matrix.build.cmd }}
      # docker.io
      - id: docker-io-login
        name: Login to docker.io
        uses: docker/login-action@v4
        with:
          registry: docker.io
          username: ${{ secrets.dockerhub_username }}
          password: ${{ secrets.dockerhub_password }}
        if: steps.check-build-needed.outputs.skipped != 'true'
      - id: buildx-setup
        name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v4
        with:
          version: "lab:latest"
          driver: cloud
          endpoint: "netboxcommunity/netbox-default"
        if: steps.check-build-needed.outputs.skipped != 'true'
      # quay.io
      - id: quay-io-login
        name: Login to Quay.io
        uses: docker/login-action@v4
        with:
          registry: quay.io
          username: ${{ secrets.quayio_username }}
          password: ${{ secrets.quayio_password }}
        if: steps.check-build-needed.outputs.skipped != 'true'
      # ghcr.io
      - id: ghcr-io-login
        name: Login to GitHub Container Registry
        uses: docker/login-action@v4
        with:
          registry: ghcr.io
          username: ${{ github.repository_owner }}
          password: ${{ secrets.GITHUB_TOKEN }}
        if: steps.check-build-needed.outputs.skipped != 'true'
      - id: build-and-push
        name: Push the image
        run: ${{ matrix.build.cmd }} --push
        if: steps.check-build-needed.outputs.skipped != 'true'
        env:
          BUILDX_PLATFORM: ${{ matrix.platform }}
          BUILDX_BUILDER_NAME: ${{ steps.buildx-setup.outputs.name }}
 

What changed

2 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 (4 with the matrix expanded) per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.

Actions used in this workflow