Skip to content

Commit

Permalink
Minor updates on Makefile and script to deploy pkgdown docs
Browse files Browse the repository at this point in the history
  • Loading branch information
wenjie2wang committed Mar 23, 2024
1 parent 1b80a2a commit 52e329e
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 36 deletions.
8 changes: 0 additions & 8 deletions .gitlab-ci.yml

This file was deleted.

35 changes: 19 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ check: $(checkLog)
build: $(tar)

.PHONY: install
install: $(tar)
install:
R build .
R CMD INSTALL $(tar)

.PHONY: preview
Expand All @@ -25,16 +26,9 @@ preview: $(vignettes)
pkgdown:
Rscript -e "library(methods); pkgdown::build_site();"

$(tar): $(objects)
@$(RM) -rf src/RcppExports.cpp R/RcppExports.R
@Rscript -e "library(methods);" \
-e "Rcpp::compileAttributes()" \
-e "devtools::document();";
@$(MAKE) updateTimestamp
R CMD build .

$(checkLog): $(tar) $(tinytest)
R CMD check --as-cran $(tar)
.PHONY: deploy-pkgdown
deploy-pkgdown:
@bash misc/deploy_docs.sh

.PHONY: check-rcpp
check-rcpp: $(tar)
Expand All @@ -48,6 +42,17 @@ check-revdep: $(tar)
@cp $(tar) revdep
R CMD BATCH --no-save --no-restore misc/revdep_check.R &

$(tar): $(objects)
@$(RM) -rf src/RcppExports.cpp R/RcppExports.R
@Rscript -e "library(methods);" \
-e "Rcpp::compileAttributes()" \
-e "devtools::document();";
@$(MAKE) update-timestamp
R CMD build .

$(checkLog): $(tar) $(tinytest)
R CMD check --as-cran $(tar)

vignettes/%.html: vignettes/%.Rmd
Rscript -e "library(methods); rmarkdown::render('$?')"

Expand All @@ -56,16 +61,14 @@ readme: README.md
README.md: README.Rmd
@Rscript -e "rmarkdown::render('$<')"

## update copyright year in HEADER, R script and date in DESCRIPTION
.PHONY: updateTimestamp
updateTimestamp:
## update copyright year
.PHONY: update-timestamp
update-timestamp:
@bash misc/update_timestamp.sh

## make tags
.PHONY: tags
tags:
Rscript -e "utils::rtags(path = 'R', ofile = 'TAGS')"
gtags

.PHONY: clean
clean:
Expand Down
25 changes: 13 additions & 12 deletions misc/deploy_docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,28 @@

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
## run locally
PKG=$(grep "Package" DESCRIPTION | awk '{print $NF}')
BUILD_DIR=$(pwd)
DOCS_REPO=$HOME/git/wwenjie.org
TARGET_DIR=$DOCS_REPO/static/$PKG
GIT_COMMIT=$(git rev-parse --short HEAD)

## update docs by pkgdown
make pkgdown

# go to the repository for wwenjie.org
cd $docs_repo
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 add static/$pkg/
git pull gitlab main
mkdir -p $TARGET_DIR
cp -r $BUILD_DIR/docs/* $TARGET_DIR
git add static/$PKG/
if [ -n "$(git diff --cached --exit-code)" ]
then
git commit -m "deploy $pkg $CI_COMMIT_SHORT_SHA by gitlab-runner"
git push origin main
git commit -m "deploy pkgdown for $PKG $GIT_COMMIT"
git push gitlab main
else
printf "The docs was not updated.\n"
fi

0 comments on commit 52e329e

Please sign in to comment.