Replies: 1 comment
-
|
The cleanest setup is to publish each platform build as an asset under one GitHub Release and then use GitHub Packages only for versioned metadata if you need it for dependency resolution. For distributing Rust or C++ binaries across Windows macOS and Linux that’s the most reliable and discoverable pattern. Use a single workflow that builds all targets in parallel with a matrix job and uploads the artifacts to the same release. This keeps versions aligned and avoids cluttering the package registry with one package per platform. i have coded a bit for you name: build and publish
on:
push:
tags:
- "v*"
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
- os: macos-latest
target: x86_64-apple-darwin
- os: windows-latest
target: x86_64-pc-windows-msvc
steps:
- uses: actions/checkout@v4
- name: build binary
run: cargo build --release --target ${{ matrix.target }}
- name: upload artifact
uses: actions/upload-artifact@v4
with:
name: mylib-${{ matrix.target }}
path: target/${{ matrix.target }}/release/mylib*
release:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
- name: create release
uses: softprops/action-gh-release@v2
with:
files: mylib-*/mylib*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}This creates one release per tag with all platform binaries attached. Consumers can download the correct one by platform or automate it through a small script. If you really need to use GitHub Packages as a registry you can publish each platform as a separate package variant under tags like mylib-linux mylib-macos mylib-windows and keep a manifest file that lists them for tooling. But for binary distribution the release approach is simpler and works everywhere. If this explanation helped please mark the answer as helpful so others can find it easily. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Select Topic Area
Question
Body
Hi, I'm Kiran, and I work at Bright Steel Centre. I have a Rust/C++ library and want to publish prebuilt binaries for Windows, macOS, Linux in a single package. How can I structure the GitHub Packages workflow to host and distribute all versions cleanly?
Beta Was this translation helpful? Give feedback.
All reactions