Skip to content

Commit c0f9187

Browse files
committed
ci: add script to update ockam docs
1 parent 4ecd7cc commit c0f9187

File tree

2 files changed

+33
-4
lines changed

2 files changed

+33
-4
lines changed

tools/docs/update_md.sh

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#!/usr/bin/env bash
2+
13
set -e
24
if [ -z "$OCKAM_HOME" ]; then
35
echo "Please set OCKAM_HOME to the repo root"
@@ -17,8 +19,8 @@ popd &>/dev/null || exit
1719

1820
# Look for md files from this directory
1921
for FILE_NAME in $(find "$DOCS_HOME" -type f -name "*.md"); do
20-
echo "==> $FILE_NAME"
21-
TMP=$(mktemp)
22-
EXAMPLES_DIR="$OCKAM_HOME/examples/rust/get_started" example_blocks "$FILE_NAME" >"$TMP"
23-
cat "$TMP" >"$FILE_NAME"
22+
echo "==> $FILE_NAME"
23+
TMP=$(mktemp)
24+
EXAMPLES_DIR="$OCKAM_HOME/examples/rust/get_started" example_blocks "$FILE_NAME" >"$TMP"
25+
cat "$TMP" >"$FILE_NAME"
2426
done

tools/scripts/release/release.sh

+27
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,27 @@ function terraform_binaries_release() {
266266
approve_and_watch_workflow_progress "terraform-provider-ockam" "$workflow_file_name" "$branch"
267267
}
268268

269+
function update_docs_repo() {
270+
set -e
271+
workflow_file_name="release-docs-update.yml"
272+
release_tag="$1"
273+
branch_name="main"
274+
275+
gh workflow run "$workflow_file_name" --ref branch_name -F branch_name="$release_name" -F ockam_ref="$release_tag" \
276+
-R $owner/ockam-documentation
277+
# Sleep for 10 seconds to ensure we are not affected by Github API downtime.
278+
sleep 10
279+
280+
# Wait for workflow run
281+
watch_workflow_progress "ockam-documentation" "$workflow_file_name" "$branch_name"
282+
283+
# Check if the branch was created, new branch is only created when there are new doc updates
284+
if gh api "repos/build-trust/ockam-documentation/branches/${release_name}" --jq .name; then
285+
gh pr create --title "Ockam Release $(date +'%d-%m-%Y')" --body "Ockam release" \
286+
--base main -H "${release_name}" -r nazmulidris -R $owner/ockam-documentation
287+
fi
288+
}
289+
269290
function delete_ockam_draft_package() {
270291
set -e
271292
versions=$(gh api -H "Accept: application/vnd.github+json" /orgs/build-trust/packages/container/ockam/versions)
@@ -369,6 +390,12 @@ if [[ $IS_DRAFT_RELEASE == true ]]; then
369390
success_info "Ockam Terraform binary release successful"
370391
fi
371392

393+
if [[ -z $SKIP_DOCS_UPDATE || $SKIP_DOCS_UPDATE == false ]]; then
394+
echo "Updating ockam documentation repository"
395+
update_docs_repo "$latest_tag_name"
396+
success_info "Ockam documentation repository pull request created..."
397+
fi
398+
372399
success_info "Ockam draft release successful"
373400
fi
374401

0 commit comments

Comments
 (0)