name: Release
on:
push:
branches: [main]
tags: ["v*"]
workflow_dispatch:
permissions:
contents: write
jobs:
gate:
runs-on: ubuntu-latest
outputs:
proceed: ${{ steps.check.outputs.proceed }}
steps:
- name: Proceed
id: check
run: echo "proceed=true" >> "$GITHUB_OUTPUT"
build:
needs: gate
if: needs.gate.outputs.proceed == 'true'
name: build (${{ matrix.target }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
archive: tar.gz
- os: ubuntu-latest
target: x86_64-unknown-linux-musl
archive: tar.gz
- os: ubuntu-24.04-arm
target: aarch64-unknown-linux-gnu
archive: tar.gz
- os: ubuntu-24.04-arm
target: aarch64-unknown-linux-musl
archive: tar.gz
- os: macos-latest
target: aarch64-apple-darwin
archive: tar.gz
- os: windows-latest
target: x86_64-pc-windows-msvc
archive: zip
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Add cross-compilation target
run: rustup target add ${{ matrix.target }}
- name: Setup Node
uses: actions/setup-node@v7
with:
node-version: 22
cache: npm
cache-dependency-path: web/package-lock.json
- name: Install musl tools
if: endsWith(matrix.target, '-linux-musl')
run: sudo apt-get update && sudo apt-get install -y musl-tools
- name: Cache cargo
uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}
- name: Build
run: cargo build --release --target ${{ matrix.target }}
- name: Package (unix)
if: matrix.archive == 'tar.gz'
shell: bash
run: |
staging="hprof-analyzer-${{ matrix.target }}"
mkdir "$staging"
cp "target/${{ matrix.target }}/release/hprof-analyzer" "$staging/"
cp LICENSE README.md "$staging/"
tar czf "$staging.tar.gz" "$staging"
echo "ASSET=$staging.tar.gz" >> "$GITHUB_ENV"
- name: Package (windows)
if: matrix.archive == 'zip'
shell: bash
run: |
staging="hprof-analyzer-${{ matrix.target }}"
mkdir "$staging"
cp "target/${{ matrix.target }}/release/hprof-analyzer.exe" "$staging/"
cp LICENSE README.md "$staging/"
7z a "$staging.zip" "$staging"
echo "ASSET=$staging.zip" >> "$GITHUB_ENV"
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.target }}
path: ${{ env.ASSET }}
release-tag:
needs: build
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
merge-multiple: true
- name: Publish release
uses: softprops/action-gh-release@v2
with:
files: artifacts/*
generate_release_notes: true
release-nightly:
needs: build
if: github.event_name != 'push' || github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
merge-multiple: true
- name: Delete existing nightly release and tag
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release delete nightly --yes --cleanup-tag 2>/dev/null || true
echo "NIGHTLY_DATE=$(date -u '+%Y-%m-%d')" >> "$GITHUB_ENV"
- name: Publish rolling nightly
uses: softprops/action-gh-release@v2
with:
tag_name: nightly
name: "Nightly (${{ env.NIGHTLY_DATE }})"
prerelease: true
files: artifacts/*
body: |
Rolling nightly build — updated on every push to `main`.
Commit: ${{ github.sha }}
## Install / Update
**Already installed?** Just run:
```sh
hprof-analyzer update nightly
```
**First install** — pick your platform below, then use `hprof-analyzer update nightly` to stay current.
**Linux x86_64 (glibc)**
```sh
curl -L https://github.com/parttimenerd/hprof-analyzer/releases/download/nightly/hprof-analyzer-x86_64-unknown-linux-gnu.tar.gz | tar xz
sudo mv hprof-analyzer-x86_64-unknown-linux-gnu/hprof-analyzer /usr/local/bin/
```
**Linux x86_64 (static musl — minimal containers, older distros)**
```sh
curl -L https://github.com/parttimenerd/hprof-analyzer/releases/download/nightly/hprof-analyzer-x86_64-unknown-linux-musl.tar.gz | tar xz
sudo mv hprof-analyzer-x86_64-unknown-linux-musl/hprof-analyzer /usr/local/bin/
```
**Linux aarch64 (glibc)**
```sh
curl -L https://github.com/parttimenerd/hprof-analyzer/releases/download/nightly/hprof-analyzer-aarch64-unknown-linux-gnu.tar.gz | tar xz
sudo mv hprof-analyzer-aarch64-unknown-linux-gnu/hprof-analyzer /usr/local/bin/
```
**macOS (Apple Silicon)**
```sh
curl -L https://github.com/parttimenerd/hprof-analyzer/releases/download/nightly/hprof-analyzer-aarch64-apple-darwin.tar.gz | tar xz
sudo mv hprof-analyzer-aarch64-apple-darwin/hprof-analyzer /usr/local/bin/
```
**Windows x86_64** — download [`hprof-analyzer-x86_64-pc-windows-msvc.zip`](https://github.com/parttimenerd/hprof-analyzer/releases/download/nightly/hprof-analyzer-x86_64-pc-windows-msvc.zip) and place `hprof-analyzer.exe` on your `PATH`.