Skip to content

Commit 067c036

Browse files
store artifacts, fix copying and other fixes (#13)
* store artifcts * fix copying and links
1 parent 52afa66 commit 067c036

File tree

7 files changed

+36
-11
lines changed

7 files changed

+36
-11
lines changed

src/commands/copy_docs_to_target.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ steps:
1111
name: "Move static content to appropriate folder"
1212
command: <<include(scripts/move_static_content.sh)>>
1313
- run:
14-
name: "Create _project_.json"
15-
command: <<include(scripts/create_project_json.sh)>>
16-
14+
name: "Create _category_.json"
15+
command: <<include(scripts/create_category_json.sh)>>
16+
- store_artifacts:
17+
path: ./target/docs
18+
- store_artifacts:
19+
path: ./target/static

src/jobs/build_docs.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@ parameters:
88
source_docs_dir:
99
type: string
1010
default: "docs"
11-
description: "The path to the ir-docs folder in the repository. Defaults to './ir-docs'."
11+
description: "The path to the ir-docs folder in the repository. Defaults to './docs'."
12+
target_docs_dir:
13+
type: string
14+
default: "docs"
15+
description: "The path to the ir-docs folder in the repository. Defaults to './docs'."
1216
label:
1317
type: string
1418
default: ""
@@ -56,6 +60,7 @@ steps:
5660
SOURCE_DOCS_DIR: <<parameters.source_docs_dir>>
5761
SOURCE_REPO_DIRECTORY_PARAM: <<parameters.source_repo_directory>>
5862
TARGET_REPO: <<parameters.target_repo>>
63+
TARGET_DOCS_DIR: <<parameters.target_docs_dir>>
5964
TARGET_REPO_DIRECTORY_PARAM: <<parameters.target_repo_directory>>
6065
command: <<include(scripts/log_env_vars.sh)>>
6166
- clone_required_repos

src/scripts/clone_required_repos.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ AddGithubToKnownHosts() {
2828

2929
# Function to clone the source repository
3030
CloneSourceRepo() {
31-
echo "Cloning source repository from $CIRCLE_REPOSITORY_URL to $SOURCE_REPO_DIRECTORY"
32-
git clone "$CIRCLE_REPOSITORY_URL" "$SOURCE_REPO_DIRECTORY" || { echo "Failed to clone source repository"; exit 1; }
31+
echo "Cloning the $CIRCLE_BRANCH branch of source repository ($CIRCLE_REPOSITORY_URL) to $SOURCE_REPO_DIRECTORY"
32+
git clone --branch "$CIRCLE_BRANCH" "$CIRCLE_REPOSITORY_URL" "$SOURCE_REPO_DIRECTORY" || { echo "Failed to clone source repository"; exit 1; }
3333
}
3434

3535
# Function to clone the target repository

src/scripts/copy_docs.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,15 @@
22

33
CopyDocs() {
44
echo "Copying documents to the target repository."
5-
cp -R "$FULL_SOURCE_DOCS_PATH" "$TARGET_REPO_DIRECTORY/$TARGET_DOCS_PATH/$PROJECT_NAME"
5+
echo "Source: $FULL_SOURCE_DOCS_PATH"
6+
echo "Destination: $FULL_TARGET_DOCS_PATH"
7+
8+
echo "Files to be copied:"
9+
# Log the list of files to be copied
10+
find "$FULL_SOURCE_DOCS_PATH" -type f -print
11+
echo "----"
12+
echo "Copying files..."
13+
cp -R "$FULL_SOURCE_DOCS_PATH" "$FULL_TARGET_DOCS_PATH/$PROJECT_NAME"
614
echo "Documents copied successfully."
715
}
816

src/scripts/create_project_json.sh renamed to src/scripts/create_category_json.sh

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,31 @@
22

33
# Assumes LABEL, DESCRIPTION, TARGET_REPO_DIRECTORY, and PROJECT_NAME are environment variables
44

5-
CreateProjectJSONFromTemplate() {
5+
CreateCategoryJSON() {
66
# Ensure the target directory exists
77
mkdir -p "$TARGET_REPO_DIRECTORY/docs/$PROJECT_NAME/"
88

99
# Inlined template with placeholders
1010
# shellcheck disable=SC2016
11-
TEMPLATE='{"label": "${LABEL}","description": "${DESCRIPTION}", "projectName":"${PROJECT_NAME}"}'
11+
TEMPLATE='{"label": "${LABEL}","link": {"type": "generated-index","title": "${LABEL}"},"customProps": {"description": "${DESCRIPTION}", "projectName":"${PROJECT_NAME}"}}'
1212

1313
# Substitute the variables in the template and write to target location
1414
echo "$TEMPLATE" | sed \
1515
-e "s/\${LABEL}/$LABEL/" \
1616
-e "s/\${DESCRIPTION}/$DESCRIPTION/" \
1717
-e "s/\${PROJECT_NAME}/$PROJECT_NAME/" \
18-
> "$TARGET_REPO_DIRECTORY/docs/$PROJECT_NAME/_project_.json"
18+
> "$TARGET_REPO_DIRECTORY/docs/$PROJECT_NAME/_category_.json"
1919

2020
echo "_project_.json file created successfully."
2121
}
2222

2323
# Check for bats
2424
ORB_TEST_ENV="bats-core"
2525
if [ "${0#*"$ORB_TEST_ENV"}" = "$0" ]; then
26-
CreateProjectJSONFromTemplate
26+
CreateCategoryJSON
2727
fi
28+
29+
30+
31+
32+

src/scripts/log_env_vars.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@
22

33
# Construct paths with $CIRCLE_WORKING_DIRECTORY
44
FULL_SOURCE_DOCS_PATH=$(eval echo "${CIRCLE_WORKING_DIRECTORY}/${SOURCE_REPO_DIRECTORY_PARAM}/${SOURCE_DOCS_DIR}")
5+
FULL_TARGET_DOCS_PATH=$(eval echo "${CIRCLE_WORKING_DIRECTORY}/${TARGET_REPO_DIRECTORY_PARAM}/${TARGET_DOCS_DIR}")
56
SOURCE_REPO_DIRECTORY=$(eval echo "${CIRCLE_WORKING_DIRECTORY}/${SOURCE_REPO_DIRECTORY_PARAM}")
67
TARGET_REPO_DIRECTORY=$(eval echo "${CIRCLE_WORKING_DIRECTORY}/${TARGET_REPO_DIRECTORY_PARAM}")
78

89
{
910
# Set environment variables for subsequent steps
1011
echo "export FULL_SOURCE_DOCS_PATH=\"${FULL_SOURCE_DOCS_PATH}\""
12+
echo "export FULL_TARGET_DOCS_PATH=\"${FULL_TARGET_DOCS_PATH}\""
1113
echo "export SOURCE_REPO_DIRECTORY=\"${SOURCE_REPO_DIRECTORY}\""
1214
echo "export TARGET_REPO_DIRECTORY=\"${TARGET_REPO_DIRECTORY}\""
1315
echo "export DESCRIPTION=\"${DESCRIPTION}\""
@@ -22,6 +24,7 @@ TARGET_REPO_DIRECTORY=$(eval echo "${CIRCLE_WORKING_DIRECTORY}/${TARGET_REPO_DIR
2224
# Log Environment Variables
2325
echo "DESCRIPTION: ${DESCRIPTION}"
2426
echo "FULL_SOURCE_DOCS_PATH: ${FULL_SOURCE_DOCS_PATH}"
27+
echo "FULL_TARGET_DOCS_PATH: ${FULL_TARGET_DOCS_PATH}"
2528
echo "GIT_EMAIL: ${GIT_EMAIL}"
2629
echo "GIT_USERNAME: ${GIT_USERNAME}"
2730
echo "LABEL: ${LABEL}"

src/scripts/validate_param.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ ValidateParam() {
55
echo "Error: Missing parameter"
66
exit 1
77
fi
8+
echo "Param is set correctly"
89
}
910

1011
ORB_TEST_ENV="bats-core"

0 commit comments

Comments
 (0)