Skip to content

chore: fmt + release 0.28.3 #109

chore: fmt + release 0.28.3

chore: fmt + release 0.28.3 #109

Workflow file for this run

name: Publish to crates.io
on:
push:
tags:
- "v*"
workflow_dispatch:
jobs:
publish:
name: cargo publish
runs-on: ubuntu-latest
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache cargo
uses: Swatinem/rust-cache@v2
- name: Verify token is set
run: |
if [ -z "$CARGO_REGISTRY_TOKEN" ]; then
echo "::error::CARGO_REGISTRY_TOKEN is empty. Check CRATES_IO_TOKEN secret."
exit 1
fi
echo "Token is set (length: ${#CARGO_REGISTRY_TOKEN})"
# Idempotent publish: a crate version that is already on crates.io is
# treated as success, so a re-run (e.g. after a partial publish) finishes
# the remaining crates instead of failing on the first one.
- name: Publish crates
run: |
# GitHub runs steps with `bash -e`; disable errexit so a non-zero
# `cargo publish` (e.g. an already-published version) doesn't abort
# the script before the per-crate tolerance check below.
set +e
publish() {
crate="$1"
out=$(cargo publish -p "$crate" 2>&1); rc=$?
echo "$out"
if [ "$rc" -eq 0 ]; then
echo ">> $crate: published"
return 0
fi
if echo "$out" | grep -q "already exists on crates.io"; then
echo ">> $crate: this version is already on crates.io — skipping"
return 0
fi
echo "::error::cargo publish $crate failed (exit $rc)"
return "$rc"
}
publish task-journal-core
echo "Waiting for crates.io to index core..."; sleep 60
publish task-journal-cli
echo "Waiting for crates.io to index cli..."; sleep 30
publish task-journal-mcp