Skip to content

Commit 0ed0fdf

Browse files
committed
chore: Migrate push-components.sh
1 parent 9055b60 commit 0ed0fdf

1 file changed

Lines changed: 23 additions & 17 deletions

File tree

scripts/push-components.sh

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,29 +6,35 @@ set -exuo pipefail
66
cd "$(dirname "$0")/.."
77

88
TAG="$1"
9-
TOML_FILE="obelisk-oci.toml"
10-
PREFIX="docker.io/getobelisk/demo_stargazers_"
9+
PREFIX="oci://docker.io/getobelisk/demo_stargazers_"
1110

12-
push() {
13-
COMPONENT_TYPE=$1
14-
RELATIVE_PATH=$2
11+
push_component() {
12+
local LOCAL_DEPLOYMENT_TOML="$1"
13+
local COMPONENT_NAME="$2"
1514

16-
FILE_NAME_WITHOUT_EXT=$(basename "$RELATIVE_PATH" | sed 's/\.[^.]*$//')
17-
OCI_LOCATION="${PREFIX}${FILE_NAME_WITHOUT_EXT}:${TAG}"
18-
echo "Pushing ${RELATIVE_PATH} to ${OCI_LOCATION}..."
19-
OUTPUT=$(obelisk component push "$RELATIVE_PATH" "$OCI_LOCATION")
15+
OCI_LOCATION="${PREFIX}${COMPONENT_NAME}:${TAG}"
16+
obelisk component push --deployment "$LOCAL_DEPLOYMENT_TOML" "$COMPONENT_NAME" "$OCI_LOCATION"
17+
}
18+
19+
push_and_update() {
20+
local LOCAL_DEPLOYMENT_TOML="$1"
21+
local COMPONENT_NAME="$2"
22+
shift 2
23+
DST_TOML_FILES=("$@")
24+
25+
OCI_LOCATION=$(push_component "$LOCAL_DEPLOYMENT_TOML" "$COMPONENT_NAME")
2026

21-
# Replace the old location with the actual OCI location
22-
obelisk component add ${COMPONENT_TYPE} ${OUTPUT} --name ${FILE_NAME_WITHOUT_EXT} --deployment $TOML_FILE
27+
for DST_TOML_FILE in "${DST_TOML_FILES[@]}"; do
28+
obelisk component add --deployment "$DST_TOML_FILE" "$OCI_LOCATION" "$COMPONENT_NAME"
29+
done
2330
}
2431

25-
# Rebuild rust components
2632
just rust
2733

28-
push activity_wasm "target/wasm32-wasip2/release/activity_llm_openai.wasm"
29-
push activity_wasm "target/wasm32-wasip2/release/activity_github_impl.wasm"
30-
push activity_wasm "target/wasm32-wasip2/release/activity_db_turso.wasm"
31-
push workflow_wasm "target/wasm32-unknown-unknown/release/workflow.wasm"
32-
push webhook_endpoint_wasm "target/wasm32-wasip2/release/webhook.wasm"
34+
push_and_update obelisk-local.toml activity_llm_openai obelisk-oci.toml
35+
push_and_update obelisk-local.toml activity_github_impl obelisk-oci.toml
36+
push_and_update obelisk-local.toml activity_db_turso obelisk-oci.toml
37+
push_and_update obelisk-local.toml workflow obelisk-oci.toml
38+
push_and_update obelisk-local.toml webhook obelisk-oci.toml
3339

3440
echo "All components pushed and TOML file updated successfully."

0 commit comments

Comments
 (0)