GitHub Actions
Overview
Section titled “Overview”Rlsr ships a composite GitHub Action so you can run releases as a single step
alongside other steps (like installing Rust or running tests). It installs a
pinned rlsr release, runs your rlsr.yml, and optionally publishes artifacts.
Quick start
Section titled “Quick start”Release on tags:
name: Release
on: push: tags: - "v*"
jobs: release: runs-on: ubuntu-latest permissions: contents: write steps: - name: Checkout uses: actions/checkout@v4 with: fetch-depth: 0 - name: Install Rust uses: dtolnay/rust-toolchain@stable - name: Release uses: iamd3vil/rlsr/.github/actions/rlsr@v0.11.0 with: config: rlsr.yml publish: true rm_dist: true github_token: ${{ secrets.GITHUB_TOKEN }}Build only (no publish), for example on pull requests. Untagged commits need --snapshot (rlsr v0.11.0 or later):
jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: fetch-depth: 0 - uses: iamd3vil/rlsr/.github/actions/rlsr@v0.11.0 with: publish: false args: --snapshotInputs
Section titled “Inputs”| Name | Type | Default | Description |
|---|---|---|---|
config | string | rlsr.yml | Path to the rlsr config file. |
publish | string | false | Publish artifacts (false passes --skip-publish). |
rm_dist | string | false | Remove the dist directory before building. |
rlsr_version | string | latest | Version tag to install (example: v0.11.0). |
args | string | "" | Extra args for rlsr (space-separated). |
working_directory | string | . | Working directory to run rlsr in. |
github_token | string | "" | Token for GitHub API operations. Falls back to GITHUB_TOKEN. |
Notes and behavior
Section titled “Notes and behavior”- Publishing needs a tag and a clean repo; otherwise
rlsrskips publish. - Use
actions/checkoutwithfetch-depth: 0so tags are available for changelogs. - Supported runners: Linux x86_64, Linux arm64 (rlsr v0.11.0 or later) and macOS arm64.
- Use
rlsr_versionto pin a known version instead oflatest.
Advanced examples
Section titled “Advanced examples”Monorepo working directory:
jobs: release: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: fetch-depth: 0 - uses: iamd3vil/rlsr/.github/actions/rlsr@v0.11.0 with: working_directory: ./crates/my-tool config: rlsr.yml publish: trueCustom runner:
jobs: release: runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 with: fetch-depth: 0 - uses: iamd3vil/rlsr/.github/actions/rlsr@v0.11.0 with: publish: falseNightly builds
Section titled “Nightly builds”Publish HEAD of the default branch every night as the rolling nightly prerelease. rlsr skips the run when the nightly tag already points at HEAD.
on: schedule: - cron: "0 3 * * *" workflow_dispatch:
jobs: nightly: runs-on: ubuntu-latest permissions: contents: write steps: - uses: actions/checkout@v4 with: fetch-depth: 0 fetch-tags: true - uses: iamd3vil/rlsr/.github/actions/rlsr@v0.11.0 with: publish: true args: --nightly github_token: ${{ secrets.GITHUB_TOKEN }}fetch-tags is needed so rlsr can see where the nightly tag points. --nightly needs rlsr v0.11.0 or later.
Build on parallel runners
Section titled “Build on parallel runners”By default rlsr runs every build on one runner. To give each target its own
runner, run rlsr with --split --targets <target> in a build matrix. Each
runner builds and packages its targets and writes a manifest to dist/. A
final job downloads every runner’s dist/ and runs rlsr --merge, which
checksums and publishes all the archives together. rlsr.yml stays the same
as for local releases.
--targets matches each build’s target: the triple for type: rust builds,
os/arch for type: go builds, or the target field you set on a custom
build.
permissions: contents: read
jobs: build: strategy: matrix: include: - name: linux target: x86_64-unknown-linux-musl - name: windows target: x86_64-pc-windows-gnu runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: fetch-depth: 0 # Install toolchains here (Rust, zig and cargo-zigbuild for type: rust). - uses: iamd3vil/rlsr/.github/actions/rlsr@v0.11.0 with: args: --split --targets ${{ matrix.target }} - uses: actions/upload-artifact@v4 with: name: dist-${{ matrix.name }} path: dist/ if-no-files-found: error
release: needs: build runs-on: ubuntu-latest permissions: contents: write steps: - uses: actions/checkout@v4 with: fetch-depth: 0 - uses: actions/download-artifact@v4 with: pattern: dist-* path: dist/ merge-multiple: true - uses: iamd3vil/rlsr/.github/actions/rlsr@v0.11.0 with: publish: true args: --merge github_token: ${{ secrets.GITHUB_TOKEN }}--split and --merge need rlsr v0.10.0 or later. The action installs the latest release by default.
Don’t pass rm_dist: true to the merge job, because it would delete the
downloaded archives. rlsr refuses --merge together with --rm-dist.
If you build binaries outside rlsr, you can still put them at each build’s
artifact path and run rlsr with --skip-build in a single final job instead.
Local testing with act
Section titled “Local testing with act”Use your normal workflow file and run it with:
act workflow_dispatch -W .github/workflows/your-workflow.yml -s GITHUB_TOKEN=dummy