ci: add retry logic and --no-verify to publish workflows #29
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: release-please | |
| on: | |
| push: | |
| branches: [main] | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| jobs: | |
| release-please: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| releases_created: ${{ steps.release.outputs.releases_created }} | |
| steps: | |
| - uses: googleapis/release-please-action@v4 | |
| id: release | |
| with: | |
| config-file: release-please-config.json | |
| manifest-file: .release-please-manifest.json | |
| publish: | |
| needs: release-please | |
| if: needs.release-please.outputs.releases_created == 'true' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| - uses: Swatinem/rust-cache@v2 | |
| - name: Publish workspace crates in dependency order | |
| run: | | |
| # Dependency order: leaves first, umbrella last. | |
| # Matches the dependency graph in CLAUDE.md. | |
| CRATES=( | |
| neuron-types | |
| neuron-tool-macros | |
| neuron-context | |
| neuron-provider-anthropic | |
| neuron-provider-openai | |
| neuron-provider-ollama | |
| neuron-otel | |
| neuron-tool | |
| neuron-mcp | |
| neuron-loop | |
| neuron-runtime | |
| neuron | |
| ) | |
| for crate in "${CRATES[@]}"; do | |
| echo "::group::$crate" | |
| # --no-verify skips rebuild (CI already validated). | |
| # Retry up to 3 times with 30s delay for index propagation. | |
| PUBLISHED=false | |
| for attempt in 1 2 3; do | |
| OUTPUT=$(cargo publish -p "$crate" --no-verify 2>&1) && { | |
| echo "Published $crate successfully" | |
| PUBLISHED=true | |
| break | |
| } | |
| if echo "$OUTPUT" | grep -q "already uploaded"; then | |
| echo "$crate already published, skipping" | |
| PUBLISHED=true | |
| break | |
| fi | |
| if [ "$attempt" -lt 3 ]; then | |
| echo "Attempt $attempt failed, waiting 30s for index propagation..." | |
| echo "$OUTPUT" | |
| sleep 30 | |
| fi | |
| done | |
| echo "::endgroup::" | |
| if [ "$PUBLISHED" = "false" ]; then | |
| echo "$OUTPUT" | |
| echo "::error::Failed to publish $crate after 3 attempts" | |
| exit 1 | |
| fi | |
| sleep 10 # pause for index propagation before next crate | |
| done | |
| echo "All crates published successfully" | |
| env: | |
| CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} |