Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: amend script with changes from sdk #40

Merged
merged 3 commits into from
Sep 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:

- name: Build Docs
run: |
./build-docs.sh
./build-legacy-docs.sh

- name: Build
run: yarn build
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
node-version: 16.x
cache: npm
- run: |
./build-docs.sh
./build-legacy-docs.sh

- run: yarn install --frozen-lockfile
- run: yarn build
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# dependencies
/node_modules
/cosmos-sdk

# production
/build
Expand All @@ -18,4 +19,4 @@

npm-debug.log*
yarn-debug.log*
yarn-error.log*
yarn-error.log*
6 changes: 5 additions & 1 deletion build-docs.sh → build-legacy-docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

rm -rf ./cosmos-sdk
git clone https://github.com/cosmos/cosmos-sdk/ cosmos-sdk;
cd cosmos-sdk/docs;
cd cosmos-sdk;
git checkout release/v0.50.x;
cd docs;

while read -r branch path_prefix; do
echo "building vuepress $branch docs"
Expand All @@ -16,3 +18,5 @@ while read -r branch path_prefix; do
cp -r .vuepress/dist/* "../../build/$path_prefix"
)
done < vuepress_versions

rm -rf ./cosmos-sdk
23 changes: 15 additions & 8 deletions sync_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@ for version in "${VERSIONS[@]}"; do
git fetch origin "$branch"
git checkout "$branch"

# Change to the 'docs' directory within the 'cosmos-sdk' repository
cd docs

# Check if the branch exists in the remote repository
if ! git show-ref --verify "refs/remotes/origin/$branch" &>/dev/null; then
echo "Branch $branch does not exist in the remote repository."
Expand All @@ -54,13 +51,19 @@ for version in "${VERSIONS[@]}"; do
fi

# Find all Markdown files in the 'docs' directory
remote_md_files=$(find "docs" -name "*.md")
if [ "$version" == "main" ]; then # update for 0.51
# main has a different strucutre then versions
remote_md_files=$(find "docs" -name "*.md")
else
cd docs
remote_md_files=$(find "docs" -name "*.md")
fi

# Change back to the original working directory
cd "$WORK_DIR"

if [ "$version" == "main" ]; then
local_md_files=$(find "docs" -name "*.md") # For 'main', the version directory is empty
local_md_files=$(find "docs" -name "*.md") # For 'main', the version directory is empty
else
# Find all Markdown files in the local versioned_docs directory
local_md_files=$(find "versioned_docs/$version_directory" -name "*.md")
Expand All @@ -81,6 +84,7 @@ for version in "${VERSIONS[@]}"; do
# Construct the relative path of the remote file
remote_relative_path="${remote_file#docs/}"


# Compare the relative paths to find matching files
if [ "$local_relative_path" = "$remote_relative_path" ]; then
# Check for differences between the local and remote files
Expand All @@ -89,8 +93,11 @@ for version in "${VERSIONS[@]}"; do
else
# Replace the local file with the remote file if differences are found
echo "Differences found for $local_file and $remote_file. Replacing $local_file with remote file..."
cp "./cosmos-sdk/docs/$remote_file" "$local_file"
echo "Local file $local_file replaced with ./cosmos-sdk/docs/$remote_file"
if [ "$version" == "main" ]; then
cp "./cosmos-sdk/$remote_file" "$local_file"
else
cp "./cosmos-sdk/docs/$remote_file" "$local_file"
fi
fi
fi
done
Expand All @@ -102,4 +109,4 @@ for version in "${VERSIONS[@]}"; do
fi
done

rm -rf ./cosmos-sdk
rm -rf ./cosmos-sdk