-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathupload-redoc-static-html-to-github.sh
More file actions
executable file
·57 lines (41 loc) · 1.12 KB
/
upload-redoc-static-html-to-github.sh
File metadata and controls
executable file
·57 lines (41 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/bash
set -e
# Check if version parameter is provided
if [ -z "$1" ]; then
echo "Version parameter is missing."
exit 1
fi
DOC_REPO_URL="git@github.com:opendatamesh-initiative/odm-site-platform.git"
DOC_REPO_NAME="odm-site-platform"
DOC_DIR="odm-site-platform/docs/assets/redoc/doc"
SCRIPT_DIR="docs/assets/redoc/scripts"
VERSION="$1"
# Clone doc repository
git clone $DOC_REPO_URL
cd $DOC_DIR
if [ -d "$VERSION" ]; then
echo "Subdirectory $VERSION exists. Overriding its content..."
# Move files to the subdirectory
cp ../../../../../redocly-docs/* $VERSION
else
echo "Subdirectory $VERSION does not exist. Creating it..."
# Create the subdirectory
mkdir $VERSION
# Move files to the subdirectory
cp ../../../../../redocly-docs/* $VERSION
fi
# Generate index.html for github pages
cd ../../../../
./$SCRIPT_DIR/updateDocPage.sh
# Add changes to the staging area
git add .
# Commit changes
git commit -m "Override or create subdirectory $DIRECTORY and add docs inside it"
# Push changes
git push origin main
git checkout pre-deploy
git merge main --no-edit
git push
# Clean up
cd ..
rm -rf $DOC_REPO_NAME