Skip to content

Commit dde59cf

Browse files
author
Alex
committed
chore: strip Gitea registry refs for crates.io publish
1 parent dc4b213 commit dde59cf

5 files changed

Lines changed: 97 additions & 10 deletions

File tree

.cargo/config.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
[registry]
22
global-credential-providers = ["cargo:token"]
33

4-
[registries.terraphim]
5-
index = "sparse+https://git.terraphim.cloud/api/packages/terraphim/cargo/"

.github/workflows/ci.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: CI
2+
on:
3+
push:
4+
branches: [main]
5+
pull_request:
6+
branches: [main]
7+
workflow_dispatch:
8+
9+
env:
10+
CARGO_TERM_COLOR: always
11+
RUST_BACKTRACE: 1
12+
13+
jobs:
14+
build:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
- uses: dtolnay/rust-toolchain@stable
19+
with:
20+
components: rustfmt, clippy
21+
- uses: Swatinem/rust-cache@v2
22+
- run: cargo fmt --all -- --check
23+
- run: cargo clippy --workspace --all-targets -- -D warnings
24+
- run: cargo build --workspace
25+
- run: cargo test --workspace --lib --no-fail-fast
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Publish Crates
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
crate_list:
6+
description: Space-separated crate package names to publish in order
7+
required: true
8+
type: string
9+
dry_run:
10+
description: Run cargo publish --dry-run only
11+
required: false
12+
default: "true"
13+
type: choice
14+
options: ["true", "false"]
15+
16+
env:
17+
CARGO_TERM_COLOR: always
18+
19+
jobs:
20+
publish:
21+
runs-on: ubuntu-latest
22+
permissions:
23+
contents: read
24+
steps:
25+
- uses: actions/checkout@v4
26+
- uses: dtolnay/rust-toolchain@stable
27+
- uses: Swatinem/rust-cache@v2
28+
- name: Publish crates in dependency order
29+
env:
30+
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
31+
CRATE_LIST: ${{ inputs.crate_list }}
32+
DRY_RUN: ${{ inputs.dry_run }}
33+
run: |
34+
set -euo pipefail
35+
for crate in $CRATE_LIST; do
36+
manifest="crates/$crate/Cargo.toml"
37+
if [ ! -f "$manifest" ]; then
38+
echo "Missing manifest for $crate at $manifest" >&2
39+
exit 1
40+
fi
41+
version=$(grep -m1 '^version' "$manifest" | sed 's/.*"\(.*\)".*/\1/')
42+
# Check crates.io with auth to avoid rate limits
43+
if curl -fsS -H "Authorization: ${CARGO_REGISTRY_TOKEN}" "https://crates.io/api/v1/crates/$crate/$version" >/dev/null 2>&1; then
44+
echo "$crate $version already exists on crates.io; skipping"
45+
continue
46+
fi
47+
if [ "$DRY_RUN" = "true" ]; then
48+
cargo publish --manifest-path "$manifest" --dry-run
49+
else
50+
set +e
51+
output=$(cargo publish --manifest-path "$manifest" 2>&1)
52+
exit_code=$?
53+
set -e
54+
if [ "$exit_code" -ne 0 ]; then
55+
if echo "$output" | grep -qi "already exists"; then
56+
echo "$crate $version already exists on crates.io; skipping"
57+
continue
58+
fi
59+
echo "$output" >&2
60+
echo "ERROR: Failed to publish $crate" >&2
61+
exit 1
62+
fi
63+
fi
64+
done

crates/terraphim_kg_agents/Cargo.toml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ uuid = { workspace = true, features = ["v4"] }
2929

3030

3131
# Terraphim dependencies
32-
terraphim_agent_registry = { version = "1.19.2", registry = "terraphim" }
33-
terraphim_agent_supervisor = { version = "1.19.2", registry = "terraphim" }
34-
terraphim_automata = { version = "1.20.2", registry = "terraphim" }
35-
terraphim_rolegraph = { version = "1.20.2", registry = "terraphim" }
36-
terraphim_task_decomposition = { version = "1.0.0", registry = "terraphim" }
37-
terraphim_types = { version = "1.20.2", registry = "terraphim" }
32+
terraphim_agent_registry = { version = "1.19.2" }
33+
terraphim_agent_supervisor = { version = "1.19.2" }
34+
terraphim_automata = { version = "1.20.2" }
35+
terraphim_rolegraph = { version = "1.20.2" }
36+
terraphim_task_decomposition = { version = "1.0.0" }
37+
terraphim_types = { version = "1.20.2" }
3838

3939
[dev-dependencies]
4040
tokio-test = "0.4"

crates/terraphim_kg_linter/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ license = "Apache-2.0"
1212
readme = "../../README.md"
1313

1414
[dependencies]
15-
terraphim_automata = { version = "1.19.2", registry = "terraphim", features = ["tokio-runtime"] }
16-
terraphim_types = { version = "1.0.0", registry = "terraphim" }
15+
terraphim_automata = { version = "1.19.2", features = ["tokio-runtime"] }
16+
terraphim_types = { version = "1.0.0" }
1717
aho-corasick = "1.1"
1818
walkdir = "2.5"
1919
regex = "1.12"

0 commit comments

Comments
 (0)