-
Notifications
You must be signed in to change notification settings - Fork 4
54 lines (52 loc) · 1.8 KB
/
publish-documentation-pr-preview.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
name: Publish Documentation PR preview
on:
pull_request:
# To manage 'surge-preview' action teardown, add default event types + closed event type
types: [opened, synchronize, reopened, closed]
branches:
- main
# keep in sync with publish-documentation-pr-preview
paths:
- '.github/actions/build-documentation-site/**/*'
- '.github/actions/build-setup/**/*'
- '.github/workflows/publish-documentation-pr-preview.yml'
- 'inst/**/*'
- 'man/**/*'
- '.Rbuildignore'
- '_pkgdown.yml'
- 'CONTRIBUTING.md'
- 'DESCRIPTION'
- 'index.md'
jobs:
# for Pull Request
pr_preview: # the id is used by surge to generate the surge url
runs-on: ubuntu-22.04
permissions:
pull-requests: write # surge-preview: PR comments
steps:
- uses: actions/checkout@v4
if: github.event.action != 'closed'
- uses: ./.github/actions/build-documentation-site
if: github.event.action != 'closed'
# Always upload the website for local browsing and when it cannot be deployed to surge
- name: Upload documentation
if: github.event.action != 'closed'
uses: actions/upload-artifact@v4
with:
name: documentation-${{github.sha}}
path: docs
- uses: bonitasoft/actions/packages/surge-preview-tools@v3
id: surge-preview-tools
with:
surge-token: ${{ secrets.SURGE_TOKEN }}
- name: Manage surge preview
if: steps.surge-preview-tools.outputs.can-run-surge-command == 'true'
id: doc_preview
uses: afc163/surge-preview@v1
with:
surge_token: ${{ secrets.SURGE_TOKEN }}
github_token: ${{ secrets.GITHUB_TOKEN }}
dist: docs
failOnError: true
teardown: true
build: ls -lh docs