-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6733141
commit 12fad6e
Showing
2 changed files
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
job: | ||
script: | ||
- bash misc/deploy_docs.sh | ||
only: | ||
- main | ||
tags: | ||
- droplets | ||
- shell |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
## run on wenjie's droplets | ||
pkg=$(grep "Package" DESCRIPTION | awk '{print $NF}') | ||
build_dir=$(pwd) | ||
docs_repo=$HOME/wenjie/wwenjie.org | ||
target_dir=$docs_repo/static/$pkg | ||
tmp_log=.git_status.log | ||
|
||
## update docs by pkgdown | ||
make pkgdown | ||
|
||
# go to the repository for wwenjie.org | ||
cd $docs_repo | ||
git checkout -f | ||
git checkout main | ||
git pull origin main | ||
mkdir -p $target_dir | ||
cp -r $build_dir/docs/* $target_dir | ||
git status > $tmp_log | ||
cat $tmp_log | ||
if egrep -q "modified:[ ]+static/$pkg/" $tmp_log | ||
then | ||
git add static/$pkg/ | ||
git commit -m "deploy $pkg $CI_COMMIT_SHORT_SHA by gitlab-runner" | ||
git push origin main | ||
else | ||
printf "The docs was not updated.\n" | ||
fi | ||
rm $tmp_log |