abalone 1.0.1

A full-screen interactive shell for CLI apps: header, input box with a command menu, status bar, help and settings panels, plus a self-updater and installer
Documentation
# Publishes a release when a tag like 1.0.0 (no v prefix) is pushed: CI
# runs first, then the tag must match the version in Cargo.toml and
# CHANGELOG.md must have a section for it. Abalone goes to crates.io first,
# then a GitHub release follows with that section as its description.
#
# crates.io: the crate's Settings > Trusted Publishing names this workflow
# (release.yml, no environment), so it publishes with a token that lasts
# 30 minutes; no secret is kept.
#
# A manual run checks but never publishes (the jobs below only publish
# from a tag).

name: Release

on:
  push:
    tags: ["[0-9]+.[0-9]+.[0-9]+*"]
  workflow_dispatch:

# Read-only by default: CI runs dependencies' build scripts. Only the
# GitHub release job can write.
permissions:
  contents: read

jobs:
  ci:
    uses: ./.github/workflows/ci.yml

  crates-io:
    name: Publish to crates.io
    needs: ci
    # Only from a tag: a manual run from a branch checks but never publishes.
    if: startsWith(github.ref, 'refs/tags/')
    runs-on: ubuntu-latest
    permissions:
      contents: read
      # For trusted publishing.
      id-token: write
    steps:
      - uses: actions/checkout@v7
        with:
          persist-credentials: false

      - name: Check the tag matches Cargo.toml
        shell: pwsh
        run: |
          $version = (cargo metadata --no-deps --format-version 1 | ConvertFrom-Json).packages |
            Where-Object name -eq 'abalone' | Select-Object -ExpandProperty version
          if ($version -ne $env:GITHUB_REF_NAME) {
            throw "tag $env:GITHUB_REF_NAME does not match Abalone's version $version in Cargo.toml"
          }

      # Before publishing, since a version on crates.io can't be taken back.
      # The notes go outside the checkout: cargo publish refuses files git
      # doesn't know about.
      - name: Check CHANGELOG.md has notes for this version
        shell: pwsh
        run: ./templates/release-notes.ps1 -Version $env:GITHUB_REF_NAME -OutDir "$env:RUNNER_TEMP/notes" -Changelog CHANGELOG.md

      - uses: dtolnay/rust-toolchain@stable

      - name: Get a token by trusted publishing
        id: auth
        uses: rust-lang/crates-io-auth-action@v1

      - name: Publish
        env:
          CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }}
        run: cargo publish --locked

  github:
    name: GitHub release
    needs: crates-io
    runs-on: ubuntu-latest
    permissions:
      contents: write
    steps:
      - uses: actions/checkout@v7
        with:
          persist-credentials: false

      - name: Read the release notes from CHANGELOG.md
        shell: pwsh
        run: ./templates/release-notes.ps1 -Version $env:GITHUB_REF_NAME -OutDir notes -Changelog CHANGELOG.md

      - name: Publish
        env:
          GH_TOKEN: ${{ github.token }}
        # The changelog section first, then GitHub's generated notes. A tag
        # with a pre-release (1.1.0-beta.1) is marked as one.
        run: |
          prerelease=
          case "$GITHUB_REF_NAME" in *-*) prerelease=--prerelease ;; esac
          gh release create "$GITHUB_REF_NAME" --title "$GITHUB_REF_NAME" --notes-file notes/release-notes.md --generate-notes --verify-tag $prerelease