Skip to content

Commit a199aad

Browse files
authored
Add gh pages (#86)
1 parent 5b79614 commit a199aad

File tree

10 files changed

+104
-0
lines changed

10 files changed

+104
-0
lines changed

.github/workflows/pages.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Deploy gh-pages
2+
3+
on:
4+
push:
5+
branches: ["master"]
6+
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: read
11+
pages: write
12+
id-token: write
13+
14+
concurrency:
15+
group: "pages"
16+
cancel-in-progress: false
17+
18+
jobs:
19+
deploy:
20+
environment:
21+
name: github-pages
22+
url: ${{ steps.deployment.outputs.page_url }}
23+
runs-on: ubuntu-latest
24+
steps:
25+
- name: Checkout
26+
uses: actions/checkout@v4
27+
- name: Build docs
28+
working-directory: r-package/maq
29+
run: |
30+
# Install pandoc
31+
sudo apt-get install -qq pandoc
32+
33+
# Install R
34+
curl -OLs https://eddelbuettel.github.io/r-ci/run.sh && chmod 0755 run.sh
35+
./run.sh bootstrap
36+
./run.sh install_all
37+
38+
# Install maq
39+
R CMD INSTALL .
40+
41+
# Use pkgdown v1.5
42+
sudo Rscript -e "install.packages(c('fs', 'highlight', 'httr', 'memoise', 'openssl', 'purrr', 'rmarkdown', 'rstudioapi', 'whisker', 'xml2', 'yaml'))"
43+
sudo Rscript -e "install.packages('https://cran.r-project.org/src/contrib/Archive/pkgdown/pkgdown_1.5.1.tar.gz', repos = NULL, type = 'source')"
44+
45+
# Build site
46+
cp ../../README.md .
47+
cp ../../REFERENCE.md .
48+
cp ../../CHANGELOG.md .
49+
Rscript -e "pkgdown::build_site()"
50+
- name: Setup Pages
51+
uses: actions/configure-pages@v5
52+
- name: Upload artifact
53+
uses: actions/upload-pages-artifact@v3
54+
with:
55+
path: 'r-package/maq/docs'
56+
- name: Deploy to GitHub Pages
57+
id: deployment
58+
uses: actions/deploy-pages@v4

r-package/maq/.Rbuildignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@
33
^docs$
44
^tests/benchmarks
55
^tests/valgrind
6+
^_pkgdown\.yml$
7+
^pkgdown$

r-package/maq/pkgdown/_pkgdown.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
url: https://github.com/grf-labs/maq
2+
navbar:
3+
type: default
4+
left:
5+
- text: "Reference"
6+
href: reference/index.html
7+
- text: "Algorithm reference"
8+
href: REFERENCE.html
9+
- text: "Changelog"
10+
href: CHANGELOG.html
11+
right:
12+
- icon: fa-github fa-lg
13+
href: https://github.com/grf-labs/maq
14+
15+
reference:
16+
- title: Multi-Armed Qini
17+
contents:
18+
- maq
19+
- predict.maq
20+
- average_gain
21+
- difference_gain
22+
- integrated_difference
23+
- get_ipw_scores
24+
- get_aipw_scores
25+
26+
- title: Plotting and printing
27+
contents:
28+
- plot.maq
29+
- print.maq
30+
- summary.maq

r-package/maq/pkgdown/extra.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// This is a workaround to get the online documentation to produce the correct GitHub
2+
// link to the source file in question. pkgdown assumes the package is hosted
3+
// under the root repo, but maq is hosted under /r-package/maq.
4+
// This fix is from: https://github.com/r-lib/pkgdown/issues/1152
5+
$(function() {
6+
if(window.location.pathname.toLocaleLowerCase().indexOf('/reference') != -1) {
7+
/* Replace '/R/' with '/r-package/maq/R/' in all external links to .R files of maq GitHub repo */
8+
$('a[href^="https://github.com/grf-labs/maq/blob/master/R"][href*=".R"]').attr('href', (i, val) => { return val.replace('/R/', '/r-package/maq/R/'); });
9+
}
10+
if(window.location.pathname.toLocaleLowerCase().indexOf('/articles') != -1) {
11+
/* Replace '/vignettes/' with '/r-package/maq/vignettes/' in all external links to .Rmd files of maq GitHub repo */
12+
$('a[href^="https://github.com/grf-labs/maq/blob/master/vignettes"][href*=".Rmd"]').attr('href', (i, val) => { return val.replace('/vignettes/', '/r-package/maq/vignettes/'); });
13+
}
14+
});
Loading
Loading
Loading
333 Bytes
Loading
661 Bytes
Loading
15 KB
Binary file not shown.

0 commit comments

Comments
 (0)