name: Release
on:
workflow_dispatch:
inputs:
confirm:
description: 'Type "publish" to confirm — this publishes dlpack-rs to crates.io and is irreversible'
required: true
default: ''
permissions:
contents: read
jobs:
publish:
name: cargo publish dlpack-rs
runs-on: ubuntu-latest
steps:
- name: Guard — require explicit confirmation
env:
CONFIRM: ${{ inputs.confirm }}
run: |
if [ "$CONFIRM" != "publish" ]; then
echo "::error::Confirmation field must be exactly 'publish' (got: '$CONFIRM')"
echo "::error::This workflow publishes to crates.io and is irreversible."
exit 1
fi
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: cargo publish --dry-run
run: cargo publish --dry-run
- name: cargo publish
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: cargo publish