Skip to content

Commit 604173a

Browse files
authored
Merge pull request #430 from cmu-delphi/netlify
ci: add docs preview
2 parents abcdd0b + f62d778 commit 604173a

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed

.github/workflows/doc-preview.yaml

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
on:
2+
issue_comment:
3+
types: [created]
4+
5+
name: doc-preview.yaml
6+
7+
permissions: read-all
8+
9+
jobs:
10+
preview:
11+
if: ${{ github.event.issue.pull_request && (github.event.comment.author_association == 'COLLABORATOR' || github.event.comment.author_association == 'CONTRIBUTOR' || github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'OWNER') && startsWith(github.event.comment.body, '/preview-docs') }}
12+
13+
runs-on: ubuntu-latest
14+
permissions:
15+
pull-requests: write
16+
contents: write
17+
steps:
18+
- name: Get PR number
19+
id: pr
20+
run: |
21+
PR_NUM=$(echo "${{ github.event.issue.number }}")
22+
echo "number=$PR_NUM" >> $GITHUB_OUTPUT
23+
24+
- uses: actions/checkout@v4
25+
with:
26+
ref: refs/pull/${{ steps.pr.outputs.number }}/head
27+
28+
- uses: r-lib/actions/setup-pandoc@v2
29+
30+
- uses: r-lib/actions/setup-r@v2
31+
with:
32+
use-public-rspm: true
33+
34+
- uses: r-lib/actions/setup-r-dependencies@v2
35+
with:
36+
extra-packages: any::pkgdown, local::.
37+
needs: website
38+
39+
- name: Build site
40+
run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)
41+
shell: Rscript {0}
42+
43+
- name: Deploy to Netlify
44+
uses: nwtgck/[email protected]
45+
with:
46+
publish-dir: './docs'
47+
production-deploy: false
48+
github-token: ${{ secrets.GITHUB_TOKEN }}
49+
deploy-message: "Deploy from GitHub Actions"
50+
enable-github-deployment: false
51+
enable-commit-status: false
52+
env:
53+
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
54+
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
55+
timeout-minutes: 1

0 commit comments

Comments
 (0)