cargo-dist
Add the install commands to every release that cargo-dist publishes on GitHub.
cargo-dist builds the release notes itself, from your changelog and its own installers, and has no option for extra text. Its releases install through installer.dev as they are. This guide only adds the installer.dev commands to the notes, next to the commands of cargo-dist’s own installers.
A custom job does the work. cargo-dist runs jobs from post-announce-jobs after it published the release, so the job can append the section to the finished notes.
Add the job
Save this reusable workflow as .github/workflows/append-install.yml. github.repository fills in your repository, so it works as it is:
name: Append install commands
on:
workflow_call:
inputs:
plan:
required: true
type: string
jobs:
append:
runs-on: ubuntu-latest
env:
GH_TOKEN: ${{ github.token }}
PLAN: ${{ inputs.plan }}
steps:
- name: Append the install section to the release notes
run: |
tag=$(jq --raw-output .announcement_tag <<< "$PLAN")
gh release view "$tag" --repo "$GITHUB_REPOSITORY" --json body --jq .body > notes.md
grep -q "https://installer.dev/" notes.md && exit 0
cat >> notes.md <<'EOF'
## Install
**macOS & Linux**
```sh
curl -fsSL https://installer.dev/${{ github.repository }}/install.sh | sh
```
**Windows** (PowerShell)
```powershell
irm https://installer.dev/${{ github.repository }}/install.ps1 | iex
```
EOF
gh release edit "$tag" --repo "$GITHUB_REPOSITORY" --notes-file notes.mdThe job reads the tag from the plan that cargo-dist passes to every custom job. It skips a release whose notes already name installer.dev, so a rerun adds the section only once. To install exactly this release, add ?version=$tag to each URL and change <<'EOF' to <<EOF, so the shell fills in the tag.
Register the job
Add the job to your cargo-dist configuration, in dist-workspace.toml or the [workspace.metadata.dist] table of Cargo.toml. The job needs write access to edit the release:
[dist]
post-announce-jobs = ["./append-install"]
github-custom-job-permissions = { "append-install" = { contents = "write" } }Then regenerate the release workflow:
dist generateThe command rewrites .github/workflows/release.yml with a custom-append-install job that runs after the announce job. Commit both workflow files and the configuration.
Check the result
The job runs with your next release. Its log in the Actions tab shows the gh release edit call, and the release page shows the section at the end of the notes.