Skip to content
Latchkey

arm64-rpi-lean-image-build workflow (raspiblitz/raspiblitz)

The arm64-rpi-lean-image-build workflow from raspiblitz/raspiblitz, explained and optimized by Latchkey.

A

CI health: A - excellent

Point runs-on at Latchkey and get 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: raspiblitz/raspiblitz.github/workflows/arm64-rpi-lean-image.ymlLicense MITView source

What it does

This is the arm64-rpi-lean-image-build workflow from the raspiblitz/raspiblitz 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: arm64-rpi-lean-image-build

concurrency:
  group: arm64-rpi-lean-image-build-${{ github.head_ref }}
  cancel-in-progress: true

on:
  workflow_dispatch:
  push:
    branches: ['dev', 'v1.10']
    paths:
      - 'build_sdcard.sh'
      - 'home.admin/bitcoin.install.sh'
      - 'home.admin/tor.install.sh'
      - 'home.admin/blitz.i2pd.sh'
      - 'home.admin/blitz.web.sh'
      - 'home.admin/blitz.display.sh'
      - 'ci/arm64-rpi/**'
  pull_request:
    branches: ['dev', 'v1.10']
    paths:
      - 'build_sdcard.sh'
      - 'home.admin/bitcoin.install.sh'
      - 'home.admin/tor.install.sh'
      - 'home.admin/blitz.i2pd.sh'
      - 'home.admin/blitz.web.sh'
      - 'home.admin/blitz.display.sh'
      - 'ci/arm64-rpi/**'

jobs:
  arm64-rpi-image-build:
    runs-on: ubuntu-22.04
    steps:
      - uses: actions/checkout@v4

      - name: Set values
        id: set_values
        run: |
          echo "BUILD_DATE=$(date +"%Y-%m-%d")" >> $GITHUB_ENV
          echo "BUILD_VERSION=$(git describe --always --tags)" >> $GITHUB_ENV
          if [ -z "$GITHUB_HEAD_REF" ]; then
            echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_ENV
          else
            echo "BRANCH_NAME=${GITHUB_HEAD_REF}" >> $GITHUB_ENV
          fi
          if [[ "${{github.event_name}}" == "pull_request" ]]; then
            echo "GITHUB_USER=${{github.event.pull_request.head.repo.owner.login}}" >> $GITHUB_OUTPUT
          else
            echo "GITHUB_USER=$(echo ${{github.repository}} | cut -d'/' -f1)" >> $GITHUB_OUTPUT
          fi

      - name: Display the build name
        run: echo "Building the raspiblitz-arm64-rpi-lean-image-${{ env.BUILD_DATE }}-${{ env.BUILD_VERSION }}"

      - name: Run the build script
        run: |
          echo "Using the variables: --pack lean --github_user ${{steps.set_values.outputs.GITHUB_USER}} --branch ${{env.BRANCH_NAME}}"
          cd ci/arm64-rpi
          bash packer.build.arm64-rpi.sh --pack lean --github_user ${{steps.set_values.outputs.GITHUB_USER}} --branch ${{env.BRANCH_NAME}}

      - name: Compute checksum of the raw image
        run: |
          cd ci/arm64-rpi
          sha256sum raspiblitz-arm64-rpi-lean.img > raspiblitz-arm64-rpi-lean.img.sha256

      - name: Compress image
        run: |
          cd ci/arm64-rpi
          gzip -v9 raspiblitz-arm64-rpi-lean.img

      - name: Compute checksum of the compressed image
        run: |
          cd ci/arm64-rpi
          sha256sum raspiblitz-arm64-rpi-lean.img.gz > raspiblitz-arm64-rpi-lean.img.gz.sha256

      - name: Upload the image and checksums
        uses: actions/upload-artifact@v4
        with:
          name: raspiblitz-arm64-rpi-image-${{ env.BUILD_DATE }}-${{ env.BUILD_VERSION }}
          path: |
            ${{ github.workspace }}/ci/arm64-rpi/raspiblitz-arm64-rpi-lean.img.sha256
            ${{ github.workspace }}/ci/arm64-rpi/raspiblitz-arm64-rpi-lean.img.gz
            ${{ github.workspace }}/ci/arm64-rpi/raspiblitz-arm64-rpi-lean.img.gz.sha256

The same workflow, on Latchkey

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

name: arm64-rpi-lean-image-build
 
concurrency:
  group: arm64-rpi-lean-image-build-${{ github.head_ref }}
  cancel-in-progress: true
 
on:
  workflow_dispatch:
  push:
    branches: ['dev', 'v1.10']
    paths:
      - 'build_sdcard.sh'
      - 'home.admin/bitcoin.install.sh'
      - 'home.admin/tor.install.sh'
      - 'home.admin/blitz.i2pd.sh'
      - 'home.admin/blitz.web.sh'
      - 'home.admin/blitz.display.sh'
      - 'ci/arm64-rpi/**'
  pull_request:
    branches: ['dev', 'v1.10']
    paths:
      - 'build_sdcard.sh'
      - 'home.admin/bitcoin.install.sh'
      - 'home.admin/tor.install.sh'
      - 'home.admin/blitz.i2pd.sh'
      - 'home.admin/blitz.web.sh'
      - 'home.admin/blitz.display.sh'
      - 'ci/arm64-rpi/**'
 
jobs:
  arm64-rpi-image-build:
    timeout-minutes: 30
    runs-on: latchkey-small
    steps:
      - uses: actions/checkout@v4
 
      - name: Set values
        id: set_values
        run: |
          echo "BUILD_DATE=$(date +"%Y-%m-%d")" >> $GITHUB_ENV
          echo "BUILD_VERSION=$(git describe --always --tags)" >> $GITHUB_ENV
          if [ -z "$GITHUB_HEAD_REF" ]; then
            echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_ENV
          else
            echo "BRANCH_NAME=${GITHUB_HEAD_REF}" >> $GITHUB_ENV
          fi
          if [[ "${{github.event_name}}" == "pull_request" ]]; then
            echo "GITHUB_USER=${{github.event.pull_request.head.repo.owner.login}}" >> $GITHUB_OUTPUT
          else
            echo "GITHUB_USER=$(echo ${{github.repository}} | cut -d'/' -f1)" >> $GITHUB_OUTPUT
          fi
 
      - name: Display the build name
        run: echo "Building the raspiblitz-arm64-rpi-lean-image-${{ env.BUILD_DATE }}-${{ env.BUILD_VERSION }}"
 
      - name: Run the build script
        run: |
          echo "Using the variables: --pack lean --github_user ${{steps.set_values.outputs.GITHUB_USER}} --branch ${{env.BRANCH_NAME}}"
          cd ci/arm64-rpi
          bash packer.build.arm64-rpi.sh --pack lean --github_user ${{steps.set_values.outputs.GITHUB_USER}} --branch ${{env.BRANCH_NAME}}
 
      - name: Compute checksum of the raw image
        run: |
          cd ci/arm64-rpi
          sha256sum raspiblitz-arm64-rpi-lean.img > raspiblitz-arm64-rpi-lean.img.sha256
 
      - name: Compress image
        run: |
          cd ci/arm64-rpi
          gzip -v9 raspiblitz-arm64-rpi-lean.img
 
      - name: Compute checksum of the compressed image
        run: |
          cd ci/arm64-rpi
          sha256sum raspiblitz-arm64-rpi-lean.img.gz > raspiblitz-arm64-rpi-lean.img.gz.sha256
 
      - name: Upload the image and checksums
        uses: actions/upload-artifact@v4
        with:
          name: raspiblitz-arm64-rpi-image-${{ env.BUILD_DATE }}-${{ env.BUILD_VERSION }}
          path: |
            ${{ github.workspace }}/ci/arm64-rpi/raspiblitz-arm64-rpi-lean.img.sha256
            ${{ github.workspace }}/ci/arm64-rpi/raspiblitz-arm64-rpi-lean.img.gz
            ${{ github.workspace }}/ci/arm64-rpi/raspiblitz-arm64-rpi-lean.img.gz.sha256
 

What changed

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