Skip to content

Commit 9c7bf3b

Browse files
authored
Move pages to github actions (#171)
1 parent 3b8ca17 commit 9c7bf3b

File tree

2 files changed

+57
-32
lines changed

2 files changed

+57
-32
lines changed

.github/workflows/pages.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
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/policytree
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 policytree
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 ../../releases/CHANGELOG.md .
48+
Rscript -e "pkgdown::build_site()"
49+
- name: Setup Pages
50+
uses: actions/configure-pages@v5
51+
- name: Upload artifact
52+
uses: actions/upload-pages-artifact@v3
53+
with:
54+
path: 'r-package/policytree/docs'
55+
- name: Deploy to GitHub Pages
56+
id: deployment
57+
uses: actions/deploy-pages@v4

azure-pipelines.yml

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -65,35 +65,3 @@ jobs:
6565
workingDirectory: r-package/policytree
6666
displayName: Valgrind check
6767
condition: eq(variables['Agent.OS'], 'Linux')
68-
# Final deploy step
69-
# Build the online docs and deploy to gh-pages - only done on master branch with Linux image.
70-
# `GITHUB_PAT` is a GitHub access token stored on Azure Pipelines.
71-
- script: |
72-
set -e
73-
sudo apt-get install -qq pandoc
74-
# Lock in a previous version of `pkgdown` and its dependencies.
75-
sudo Rscript -e "install.packages(c('fs', 'highlight', 'httr', 'memoise', 'openssl', 'purrr', 'rmarkdown', 'rstudioapi', 'whisker', 'xml2', 'yaml'))"
76-
sudo Rscript -e "install.packages('https://cran.r-project.org/src/contrib/Archive/pkgdown/pkgdown_1.5.1.tar.gz', repos = NULL, type = 'source')"
77-
# Install dependencies needed for vignettes.
78-
sudo Rscript -e "install.packages(c('DiagrammeR'))"
79-
cp ../../README.md .
80-
cp ../../releases/CHANGELOG.md .
81-
# Build and deploy page. This requires that the branch `gh-pages` exists.
82-
# git worktree is used to only commit the doc folder (docs/) as the root.
83-
# update-ref is used to not keep a commit history of the generated docs.
84-
git config --local user.email "azuredevops@microsoft.com"
85-
git config --local user.name "Azure Pipelines"
86-
git worktree add -B gh-pages docs/ origin/gh-pages
87-
rm -rf docs/*
88-
Rscript -e "pkgdown::build_site()"
89-
cd docs
90-
git add --all
91-
git update-ref -d refs/heads/gh-pages
92-
git commit --allow-empty -m "Update gh-pages ***NO_CI***"
93-
git push --force https://$(GITHUB_PAT)@github.com/grf-labs/policytree.git HEAD:gh-pages
94-
workingDirectory: r-package/policytree
95-
displayName: 'Publish GitHub Pages'
96-
condition: |
97-
and(eq(variables['Agent.OS'], 'Linux'),
98-
and(not(eq(variables['Build.Reason'], 'PullRequest')),
99-
eq(variables['Build.SourceBranch'], 'refs/heads/master')))

0 commit comments

Comments
 (0)