name: Bootstrap canonical Weavatrix Cargo 1.1.2
on:
workflow_dispatch:
inputs:
confirmation:
description: Type publish-weavatrix-cargo-1.1.2 to confirm this one-time publication
required: true
type: string
permissions:
contents: read
concurrency:
group: bootstrap-canonical-weavatrix-cargo-1.1.2
cancel-in-progress: false
env:
WEAVATRIX_REPOSITORY: Weavatrix/weavatrix
WEAVATRIX_SOURCE_SHA: 8025da0c3e4373faacb89b27fdac3f5de6088afa
WEAVATRIX_VERSION: 1.1.2
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
jobs:
publish:
runs-on: ubuntu-24.04
timeout-minutes: 20
steps:
- name: Confirm the fixed publication boundary
env:
CONFIRMATION: ${{ inputs.confirmation }}
shell: bash
run: |
set -euo pipefail
[[ "$GITHUB_REPOSITORY" == "Weavatrix/weavatrix-git" ]]
[[ "$CONFIRMATION" == "publish-weavatrix-cargo-1.1.2" ]]
- name: Check out the exact canonical Weavatrix source
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 with:
repository: ${{ env.WEAVATRIX_REPOSITORY }}
ref: ${{ env.WEAVATRIX_SOURCE_SHA }}
path: source
fetch-depth: 1
persist-credentials: false
- name: Install the declared Rust toolchain
uses: dtolnay/rust-toolchain@2c7215f132e9ebf062739d9130488b56d53c060c with:
toolchain: 1.89.0
components: rustfmt, clippy
- name: Verify source, package, and architecture
working-directory: source
shell: bash
run: |
set -euo pipefail
[[ "$(git rev-parse HEAD)" == "$WEAVATRIX_SOURCE_SHA" ]]
NAME="$(cargo metadata --locked --no-deps --format-version 1 | jq -r '.packages[0].name')"
VERSION="$(cargo metadata --locked --no-deps --format-version 1 | jq -r '.packages[0].version')"
[[ "$NAME" == "weavatrix" ]]
[[ "$VERSION" == "$WEAVATRIX_VERSION" ]]
cargo fmt --all -- --check
cargo clippy --locked --all-targets -- -D warnings
cargo test --locked --all-targets
cargo run --quiet --locked -- tool verify_architecture . |
jq -e '.state == "PASS" and (.new | length) == 0 and (.existing | length) == 0 and (.excepted | length) == 0'
cargo publish --locked --dry-run
- name: Publish the immutable crate once
working-directory: source
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
shell: bash
run: |
set -euo pipefail
if cargo info --color never --registry crates-io "weavatrix@$WEAVATRIX_VERSION" >/dev/null 2>&1; then
echo "weavatrix@$WEAVATRIX_VERSION already exists; skipping publish"
else
[[ -n "$CARGO_REGISTRY_TOKEN" ]]
cargo publish --locked --no-verify
fi
- name: Verify the crates.io artifact
shell: bash
run: |
set -euo pipefail
for attempt in $(seq 1 24); do
if cargo info --color never --registry crates-io "weavatrix@$WEAVATRIX_VERSION" >/dev/null 2>&1; then
exit 0
fi
echo "Waiting for crates.io consistency (attempt $attempt/24)"
sleep 5
done
echo "weavatrix@$WEAVATRIX_VERSION did not become visible" >&2
exit 1