Skip to content

fix: add a step to publish the release #13

fix: add a step to publish the release

fix: add a step to publish the release #13

Workflow file for this run

# .github/workflows/release.yml
name: Release CLI
on:
push:
tags:
- '**' # match all tags, e.g. 1.0.0, release-1, beta, etc.
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
jobs:
# ---------- 1. Build binaries ----------
build-binaries:
name: Build runbeam-cli binaries (cross/native)
strategy:
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-musl
- os: ubuntu-latest
target: aarch64-unknown-linux-musl
- os: windows-latest
target: x86_64-pc-windows-msvc
- os: macos-latest
target: x86_64-apple-darwin
- os: macos-latest
target: aarch64-apple-darwin
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
# Linux builds use cross
- name: Build runbeam-cli (Linux cross)
if: runner.os == 'Linux'
shell: bash
run: |
cargo install cross --git https://github.com/cross-rs/cross
cross build --release --target ${{ matrix.target }}
# Non-Linux builds are native
- name: Build runbeam-cli (native)
if: runner.os != 'Linux'
run: cargo build --release --target ${{ matrix.target }}
- name: Package artefacts (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
New-Item -ItemType Directory -Force -Path release | Out-Null
Compress-Archive -Path "target/${{ matrix.target }}/release/runbeam.exe" -DestinationPath "release/runbeam-${{ matrix.target }}.zip" -Force
Get-FileHash "release/runbeam-${{ matrix.target }}.zip" -Algorithm SHA256 | ForEach-Object { $_.Hash + " runbeam-${{ matrix.target }}.zip" } | Out-File "release/runbeam-${{ matrix.target }}.sha256" -Encoding ascii
- name: Package artefacts (Unix)
if: runner.os != 'Windows'
shell: bash
run: |
mkdir -p release
tar czf release/runbeam-${{ matrix.target }}.tar.gz -C target/${{ matrix.target }}/release runbeam
shasum -a 256 release/runbeam-${{ matrix.target }}.tar.gz > release/runbeam-${{ matrix.target }}.sha256
- name: Upload artefacts
uses: actions/upload-artifact@v4
with:
name: runbeam-${{ matrix.target }}
path: release/
# ---------- 3. Publish GitHub Release ----------
release:
name: Publish GitHub Release
runs-on: ubuntu-latest
needs: [build-binaries]
if: startsWith(github.ref, 'refs/tags/')
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download runbeam build artefacts only
uses: actions/download-artifact@v4
with:
path: ./artifacts
pattern: runbeam-*
merge-multiple: true
- name: Generate combined checksums manifest
shell: bash
run: |
cd artifacts
find . -type f -name "*.sha256" -exec cat {} \; > checksums.txt
echo "Combined checksums:"
cat checksums.txt
- name: Delete existing release if present
shell: bash
run: |
if gh release view ${{ github.ref_name }} &>/dev/null; then
echo "Release exists, deleting..."
gh release delete ${{ github.ref_name }} --yes --cleanup-tag
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.ref_name }}
name: runbeam-cli ${{ github.ref_name }}
files: ./artifacts/**/*
draft: true
make_latest: false
fail_on_unmatched_files: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Verify release
shell: bash
run: |
echo "Verifying release was created successfully..."
gh release view ${{ github.ref_name }} --json assets
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish release
shell: bash
run: |
echo "Publishing release ${{ github.ref_name }}..."
gh release edit ${{ github.ref_name }} --draft=false --latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}