Skip to content

Build the documentation with mdbook 0.5.4 #919

Build the documentation with mdbook 0.5.4

Build the documentation with mdbook 0.5.4 #919

Workflow file for this run

name: release
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
on:
pull_request:
push:
branches:
- trunk
tags:
- "[0-9]+.[0-9]+.[0-9]+"
workflow_dispatch:
permissions: {}
defaults:
run:
shell: bash
env:
name: row
CARGO_TERM_COLOR: always
CLICOLOR: 1
jobs:
source:
name: Build source tarball
runs-on: ubuntu-24.04
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
path: code
persist-credentials: false
- name: Determine filename-safe ref from GITHUB_REF_NAME
run: echo ref="$(echo "${GITHUB_REF_NAME}" | sed -e 's/\//-/g')" >> "$GITHUB_ENV"
- name: Copy source
run: cp -R code "${name}-${ref}"
- name: Remove .git
run: rm -rf "${name}-${ref}/.git" && ls -laR "${name}-${ref}"
- name: Tar/zstd source
run: tar --zstd -cvf "${name}-${ref}.tar.zst" "${name}-${ref}"
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: source
path: |
*.tar.*
release-notes:
name: Extract release notes
runs-on: ubuntu-24.04
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
path: code
persist-credentials: false
- name: Write release-notes.md
# 1. Search for the content from the start of the file to the 2nd version heading.
# 2. Remove the 2nd version heading.
# 3. Search for the content after the first version heading (removes any description at the
# start of the file.
# 4. Remove the 1st version heading.
# This leaves the content of the release notes for the current release.
run: >
grep -P -m 2 -B 10000 "^## v*\d*\.\d*\.\d*" doc/src/release-notes.md |
sed '$d' |
grep -P -A 10000 "^## v*\d*\.\d*\.\d*" |
sed '1d' |
tee "${GITHUB_WORKSPACE}/release-notes.md"
working-directory: code
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: release-notes
path: |
release-notes.md
binary:
name: Build [${{ matrix.target }}]
runs-on: ${{ matrix.runner }}
strategy:
matrix:
target:
- x86_64-unknown-linux-musl
- aarch64-apple-darwin
include:
- target: x86_64-unknown-linux-musl
runner: ubuntu-22.04
- target: aarch64-apple-darwin
runner: macos-14
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
- name: Determine filename-safe ref from GITHUB_REF_NAME
run: echo ref="$(echo "${GITHUB_REF_NAME}" | sed -e 's/\//-/g')" >> "$GITHUB_ENV"
- name: Configure Rust
id: rust_toolchain
uses: dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9
with:
toolchain: 1.96.1
targets: ${{ matrix.target }}
- name: Install musl-tools on Linux
run: sudo apt-get update --yes && sudo apt-get install --yes musl-tools
if: contains(matrix.target, 'musl')
- name: Build
run: cargo build --locked --bin "${name}" --release --target ${{ matrix.target }}
- name: Check output
run: file "target/${{ matrix.target }}/release/${name}"
- name: Compress
run: cp "target/${{ matrix.target }}/release/${name}" . && tar --zstd -cvf "${name}-${ref}-${{ matrix.target }}.tar.zst" "${name}"
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: ${{ matrix.target }}
path: "${{ env.name }}-${{ env.ref }}-${{ matrix.target }}.tar.zst"
publish_github:
name: Publish [GitHub]
needs: [binary, source, release-notes]
runs-on: ubuntu-24.04
permissions:
contents: write
steps:
- name: Download artifacts
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
merge-multiple: true
- name: List files
run: ls -lR
- name: Create release
if: github.ref_type == 'tag'
run: gh release create "${GITHUB_REF_NAME}" ./*.zst* -F release-notes.md --verify-tag --repo "${GITHUB_REPOSITORY}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
publish_cargo:
name: Publish [Cargo]
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-24.04
environment: release
permissions:
contents: read
id-token: write
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
- name: Configure Rust
id: rust_toolchain
uses: dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9
with:
toolchain: 1.96.1
- name: Authorize with crates.io
uses: rust-lang/crates-io-auth-action@c6f97d42243bad5fab37ca0427f495c86d5b1a18 # v1.0.5
id: auth
- name: Publish to crates.io
run: cargo publish --all-features
env:
CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }}