Skip to content
Latchkey

Build and Release workflow (ai-shifu/ChatALL)

The Build and Release workflow from ai-shifu/ChatALL, explained and optimized by Latchkey.

D

CI health: D - needs work

Point runs-on at Latchkey and get caching, 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: ai-shifu/ChatALL.github/workflows/release.ymlLicense Apache-2.0View source

What it does

This is the Build and Release workflow from the ai-shifu/ChatALL 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 and Release

on:
  push:
    tags:
      - "v*.*.*"

jobs:
  build-and-release-macos:
    runs-on: macos-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v2

      - name: Setup Node.js
        uses: actions/setup-node@v3
        with:
          node-version: "20.x"

      - name: Setup Python
        uses: actions/setup-python@v4
        with:
          python-version: "3.11"

      - name: Install dependencies
        run: npm install

      - name: Build and release
        env:
          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          CSC_LINK: ${{ secrets.MAC_CERTS }}
          CSC_KEY_PASSWORD: ${{ secrets.MAC_CERTS_PASSWORD }}
          APPLE_ID: ${{ secrets.APPLE_ID }}
          APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }}
        run: |
          export PYTHON_PATH=`which python`
          npm run release-macos

  build-and-release-ubuntu:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v2

      - name: Setup Node.js
        uses: actions/setup-node@v3
        with:
          node-version: "20.x"

      - name: Setup Python
        uses: actions/setup-python@v4
        with:
          python-version: "3.11"

      - name: Install dependencies
        run: npm install

      - name: Build and release
        env:
          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        run: npm run release-linux

  build-and-release-windows:
    runs-on: windows-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v2

      - name: Setup Node.js
        uses: actions/setup-node@v3
        with:
          node-version: "20.x"

      - name: Setup Python
        uses: actions/setup-python@v4
        with:
          python-version: "3.11"

      - name: Install dependencies
        run: npm install

      - name: Build and release
        env:
          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        run: npm run release-windows

The same workflow, on Latchkey

Estimated ~20% faster on cache hits, plus fewer wasted runs and a safer supply chain. Added and changed lines are highlighted.

name: Build and Release
 
on:
  push:
    tags:
      - "v*.*.*"
 
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  build-and-release-macos:
    timeout-minutes: 30
    runs-on: macos-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v2
 
      - name: Setup Node.js
        uses: actions/setup-node@v3
        with:
          cache: 'npm'
          node-version: "20.x"
 
      - name: Setup Python
        uses: actions/setup-python@v4
        with:
          python-version: "3.11"
 
      - name: Install dependencies
        run: npm install
 
      - name: Build and release
        env:
          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          CSC_LINK: ${{ secrets.MAC_CERTS }}
          CSC_KEY_PASSWORD: ${{ secrets.MAC_CERTS_PASSWORD }}
          APPLE_ID: ${{ secrets.APPLE_ID }}
          APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }}
        run: |
          export PYTHON_PATH=`which python`
          npm run release-macos
 
  build-and-release-ubuntu:
    timeout-minutes: 30
    runs-on: latchkey-small
    steps:
      - name: Checkout code
        uses: actions/checkout@v2
 
      - name: Setup Node.js
        uses: actions/setup-node@v3
        with:
          cache: 'npm'
          node-version: "20.x"
 
      - name: Setup Python
        uses: actions/setup-python@v4
        with:
          python-version: "3.11"
 
      - name: Install dependencies
        run: npm install
 
      - name: Build and release
        env:
          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        run: npm run release-linux
 
  build-and-release-windows:
    timeout-minutes: 30
    runs-on: windows-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v2
 
      - name: Setup Node.js
        uses: actions/setup-node@v3
        with:
          cache: 'npm'
          node-version: "20.x"
 
      - name: Setup Python
        uses: actions/setup-python@v4
        with:
          python-version: "3.11"
 
      - name: Install dependencies
        run: npm install
 
      - name: Build and release
        env:
          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        run: npm run release-windows
 

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 3 jobs per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.

Actions used in this workflow