Skip to content

Commit 5cb7b78

Browse files
authored
Move pages to github actions (#1423)
1 parent 289a740 commit 5cb7b78

File tree

2 files changed

+66
-34
lines changed

2 files changed

+66
-34
lines changed

.github/workflows/pages.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
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: Setup build
28+
working-directory: r-package/grf
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 grf
39+
R CMD INSTALL .
40+
- name: Setup docs
41+
working-directory: r-package/grf
42+
run: |
43+
# Install pkgdown v1.5
44+
sudo Rscript -e "install.packages(c('fs', 'highlight', 'httr', 'memoise', 'openssl', 'purrr', 'rmarkdown', 'rstudioapi', 'whisker', 'xml2', 'yaml'))"
45+
sudo Rscript -e "install.packages('https://cran.r-project.org/src/contrib/Archive/pkgdown/pkgdown_1.5.1.tar.gz', repos = NULL, type = 'source')"
46+
47+
# Install packages used in vignettes
48+
sudo Rscript -e "install.packages(c('ggplot2', 'glmnet', 'maq', 'policytree'))"
49+
- name: Build docs
50+
working-directory: r-package/grf
51+
run: |
52+
# Build site
53+
cp ../../README.md .
54+
cp ../../REFERENCE.md .
55+
cp ../../DEVELOPING.md .
56+
cp ../../releases/CHANGELOG.md .
57+
Rscript -e "pkgdown::build_site()"
58+
- name: Setup Pages
59+
uses: actions/configure-pages@v5
60+
- name: Upload artifact
61+
uses: actions/upload-pages-artifact@v3
62+
with:
63+
path: 'r-package/grf/docs'
64+
- name: Deploy to GitHub Pages
65+
id: deployment
66+
uses: actions/deploy-pages@v4

azure-pipelines.yml

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -106,37 +106,3 @@ jobs:
106106
workingDirectory: r-package/grf
107107
displayName: Valgrind check
108108
condition: eq(variables['Agent.OS'], 'Linux')
109-
# Final deploy step:
110-
# Build the online docs and deploy to gh-pages - only done on master branch with Linux image.
111-
# `GITHUB_PAT` is a GitHub access token stored on Azure Pipelines.
112-
- script: |
113-
set -e
114-
sudo apt-get install -qq pandoc
115-
# Lock in a previous version of `pkgdown` and its dependencies.
116-
sudo Rscript -e "install.packages(c('fs', 'highlight', 'httr', 'memoise', 'openssl', 'purrr', 'rmarkdown', 'rstudioapi', 'whisker', 'xml2', 'yaml'))"
117-
sudo Rscript -e "install.packages('https://cran.r-project.org/src/contrib/Archive/pkgdown/pkgdown_1.5.1.tar.gz', repos = NULL, type = 'source')"
118-
# Install dependencies needed for vignettes.
119-
sudo Rscript -e "install.packages(c('DiagrammeR', 'ggplot2', 'glmnet', 'maq', 'policytree', 'rdd'))"
120-
cp ../../README.md .
121-
cp ../../REFERENCE.md .
122-
cp ../../DEVELOPING.md .
123-
cp ../../releases/CHANGELOG.md .
124-
# Build and deploy page. This requires that the branch `gh-pages` exists.
125-
# git worktree is used to only commit the doc folder (docs/) as the root.
126-
# update-ref is used to not keep a commit history of the generated docs.
127-
git config --local user.email "[email protected]"
128-
git config --local user.name "Azure Pipelines"
129-
git worktree add -B gh-pages docs/ origin/gh-pages
130-
rm -rf docs/*
131-
Rscript -e "pkgdown::build_site()"
132-
cd docs
133-
git add --all
134-
git update-ref -d refs/heads/gh-pages
135-
git commit --allow-empty -m "Update gh-pages ***NO_CI***"
136-
git push --force https://$(GITHUB_PAT)@github.com/grf-labs/grf.git HEAD:gh-pages
137-
workingDirectory: r-package/grf
138-
displayName: 'Publish GitHub Pages'
139-
condition: |
140-
and(eq(variables['Agent.OS'], 'Linux'),
141-
and(not(eq(variables['Build.Reason'], 'PullRequest')),
142-
eq(variables['Build.SourceBranch'], 'refs/heads/master')))

0 commit comments

Comments
 (0)