-
Notifications
You must be signed in to change notification settings - Fork 2k
Expand file tree
/
Copy pathdeploy-userguide
More file actions
executable file
·61 lines (47 loc) · 1.31 KB
/
deploy-userguide
File metadata and controls
executable file
·61 lines (47 loc) · 1.31 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
58
59
60
61
#!/bin/bash
## Deploy codeigniter4/userguide
# Setup variables
SOURCE=$1
TARGET=$2
RELEASE=$3
# Check if RELEASE is empty
if [ -z "$RELEASE" ]; then
echo "Error: \$RELEASE parameter is empty."
exit 1
fi
VERSION=$(echo "$RELEASE" | cut -c 2-)
# Check if VERSION is empty
if [ -z "$VERSION" ]; then
echo "Error: Failed to extract \$VERSION from \$RELEASE parameter '$RELEASE'."
exit 1
fi
# Check if VERSION matches the format X.Y.Z
if ! [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Error: VERSION '$VERSION' does not match the expected format X.Y.Z."
exit 1
fi
echo "Preparing for version $3"
echo "Merging files from $1 to $2"
# Prepare the source
cd $SOURCE
git checkout master
cd user_guide_src
make html
make epub
# Prepare the target
cd $TARGET
git checkout master
rm -rf docs
# Copy common files
cp -Rf ${SOURCE}/LICENSE ./
# Copy repo-specific files
cp -Rf ${SOURCE}/admin/userguide/. ./
# Copy files
cp -Rf ${SOURCE}/user_guide_src/build/html ./docs
cp -Rf ${SOURCE}/user_guide_src/build/epub/CodeIgniter.epub ./CodeIgniter${VERSION}.epub
# Ensure underscore prefixed files are published
touch ${TARGET}/docs/.nojekyll
# Commit the changes
git add .
git commit -m "Release ${RELEASE}"
bash ${SOURCE}/.github/scripts/secure-git-push https://github.com/codeigniter4/userguide.git HEAD:master