Skip to content

Commit 18a613a

Browse files
author
Ian Jonsen
committed
1 parent b6f62a5 commit 18a613a

File tree

1 file changed

+23
-22
lines changed

1 file changed

+23
-22
lines changed

.github/workflows/pkgdown.yaml

+23-22
Original file line numberDiff line numberDiff line change
@@ -9,46 +9,47 @@ name: pkgdown
99

1010
jobs:
1111
pkgdown:
12+
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork == false
1213
runs-on: ubuntu-latest
1314
env:
1415
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
16+
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
17+
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
18+
isPush: ${{ github.event_name == 'push' }}
19+
1520
steps:
1621
- uses: actions/checkout@v2
1722

23+
- uses: r-lib/actions/setup-tinytex@v2
24+
1825
- uses: r-lib/actions/setup-pandoc@v2
1926

2027
- uses: r-lib/actions/setup-r@v2
28+
with:
29+
use-public-rspm: true
2130

2231
- uses: r-lib/actions/setup-r-dependencies@v2
2332
with:
24-
extra-packages: pkgdown
33+
extra-packages: any::pkgdown, local::.
2534
needs: website
26-
27-
- name: Query dependencies
28-
run: |
29-
install.packages('remotes')
30-
saveRDS(remotes::dev_package_deps(dependencies=TRUE), ".github/depends.Rds", version = 2)
31-
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
32-
shell: Rscript {0}
33-
34-
- name: Cache R packages
35-
uses: actions/cache@v2
36-
with:
37-
path: ${{ env.R_LIBS_USER }}
38-
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
39-
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-
40-
41-
- name: Install dependencies
42-
run: |
43-
remotes::install_deps(dependencies=TRUE)
44-
install.packages("pkgdown", type = "source")
45-
shell: Rscript {0}
4635

4736
- name: Install package
4837
run: R CMD INSTALL .
4938

50-
- name: Deploy package
39+
- name: Build and deploy pkgdown site
40+
if: contains(env.isPush, 'true')
5141
run: |
5242
git config --local user.name "$GITHUB_ACTOR"
5343
git config --local user.email "[email protected]"
5444
Rscript -e 'pkgdown::deploy_to_branch(new_process = FALSE)'
45+
- name: Create website
46+
if: contains(env.isPush, 'false')
47+
run: |
48+
pkgdown::build_site()
49+
shell: Rscript {0}
50+
51+
- name: Create index file
52+
if: contains(env.isPush, 'false')
53+
run: |
54+
echo '<!DOCTYPE html><html><head><meta http-equiv="refresh" content="0;URL=/dev/index.html" /> <script language="javascript"> window.location.replace('/dev/index.html')</script></head></html>' > ./docs/index.html
55+

0 commit comments

Comments
 (0)