Skip to content
Latchkey

How to Upload Cross-Platform Binaries to a Release in GitHub Actions

A matrix builds one binary per OS in parallel; upload each as a per-OS artifact and attach them all to the single release.

Run a build matrix over runs-on, name the output by matrix.os, and have each matrix leg upload its binary directly to the release with files:.

Steps

  • Set strategy.matrix.os and runs-on: ${{ matrix.os }}.
  • Build and name the binary by platform.
  • Each leg runs action-gh-release with its own files: entry.

Workflow

.github/workflows/release.yml
on:
  push:
    tags: ['v*.*.*']
permissions:
  contents: write
jobs:
  build:
    strategy:
      matrix:
        os: [ubuntu-latest, macos-latest, windows-latest]
    runs-on: ${{ matrix.os }}
    steps:
      - uses: actions/checkout@v4
      - run: cargo build --release
      - uses: softprops/action-gh-release@v2
        with:
          files: target/release/mytool*

Gotchas

  • Use a per-OS file name or path so the three legs do not overwrite each other.
  • Latchkey offers native arm64 runners so cross-platform release builds run without QEMU overhead.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →