Skip to content

chore: Prepare 0.5.0 release (#288) #32

chore: Prepare 0.5.0 release (#288)

chore: Prepare 0.5.0 release (#288) #32

Workflow file for this run

name: Release
on:
push:
branches: [ master ]
tags: [ "v*" ]
workflow_dispatch:
inputs:
label:
type: string
description: Overrides the label for binaries (by default, branch or tag name)
required: false
default: ''
defaults:
run:
shell: bash
env:
# Nightly Rust necessary for building docs.
nightly: nightly-2025-11-02
# `mdbook` version used
MDBOOK_VERSION: 0.5.2
jobs:
release:
permissions:
contents: write
strategy:
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
- os: macos-latest
target: x86_64-apple-darwin
- os: macos-latest
target: aarch64-apple-darwin
- os: windows-latest
target: x86_64-pc-windows-msvc
runs-on: ${{ matrix.os }}
name: Release ${{ matrix.target }}
steps:
- uses: actions/checkout@v6
- name: Determine release type
id: release-type
run: |
if [[ ${{ github.ref }} =~ ^refs/tags/[0-9]+[.][0-9]+[.][0-9]+$ ]]; then
echo 'type=release' >> "$GITHUB_OUTPUT"
else
echo 'type=prerelease' >> "$GITHUB_OUTPUT"
fi
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
targets: ${{ matrix.target }}
- name: Cache cargo build
uses: actions/cache@v5
with:
path: target
key: ${{ runner.os }}-release-cargo-${{ hashFiles('Cargo.lock') }}
restore-keys: ${{ runner.os }}-release-cargo
- name: Build CLI app
run: |
cargo build -p term-transcript-cli \
--profile=executable \
--target=${{ matrix.target }} \
--all-features \
--locked
- name: Package archive
id: package
run: ./crates/term-transcript-cli/package.sh ${REF#refs/*/}
env:
OS: ${{ matrix.os }}
TARGET: ${{ matrix.target }}
REF: ${{ inputs.label == '' && github.ref || inputs.label }}
- name: Publish archive
uses: softprops/action-gh-release@v1
if: github.event_name == 'push' && github.ref_type == 'tag'
with:
draft: false
files: ${{ steps.package.outputs.archive }}
prerelease: ${{ steps.release-type.outputs.type == 'prerelease' }}
- name: Attach archive to workflow
uses: actions/upload-artifact@v6
if: github.ref_type == 'branch'
with:
name: term-transcript-${{ matrix.target }}
path: ${{ steps.package.outputs.archive }}
document:
# Build and deploy docs on each push to the default branch
if: github.ref_type == 'branch'
needs: release
permissions:
contents: read
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.nightly }}
- name: Install mdbook
run: |
mkdir -p .bin
curl -sSL https://github.com/rust-lang/mdBook/releases/download/v$MDBOOK_VERSION/mdbook-v$MDBOOK_VERSION-x86_64-unknown-linux-gnu.tar.gz \
| tar -xz --directory=.bin
sudo install .bin/mdbook /usr/local/bin
mdbook --version
- name: Cache cargo build
uses: actions/cache@v5
with:
path: target
key: ${{ runner.os }}-cargo-document-${{ hashFiles('Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-document
- name: Build the Book
working-directory: ./docs
run: mdbook clean && mdbook build
- name: Build crate docs
run: |
cargo clean --doc
cargo rustdoc -p term-transcript --all-features -- -D warnings --cfg docsrs
mkdir -p docs/book/crates
mv target/doc/* docs/book/crates
- name: Download binary artifacts
uses: actions/download-artifact@v7
with:
path: docs/book/assets
pattern: term-transcript-*
merge-multiple: true
- name: List binaries
run: ls -al docs/book/assets/term-transcript-*
- name: Setup Pages
id: pages
uses: actions/configure-pages@v5
- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v4
with:
path: docs/book
deploy-pages:
needs: document
if: github.ref_type == 'branch'
permissions:
pages: write
id-token: write
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to Pages
id: deployment
uses: actions/deploy-pages@v4