Skip to content

Commit 7267bf4

Browse files
committed
wf: only manage PR use case for now
1 parent 7961f2d commit 7267bf4

File tree

1 file changed

+47
-23
lines changed

1 file changed

+47
-23
lines changed

.github/workflows/publish-documentation.yml

Lines changed: 47 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -17,51 +17,41 @@ on:
1717
- 'DESCRIPTION'
1818
- 'README.md' # TODO use the right file, the repo from the repo cannot be included (wrong format, too much info)
1919
jobs:
20-
generate:
21-
if: github.event.action != 'closed' # on PR closed, only teardown the surge deployment
20+
# for Pull Request
21+
# TODO manage close pr for surge teardown if: github.event.action != 'closed'
22+
pr_preview:
23+
# TODO test Ubuntu 22
2224
runs-on: ubuntu-20.04
25+
permissions:
26+
pull-requests: write # surge-preview: PR comments
2327
steps:
2428
- uses: actions/checkout@v3
2529

30+
# TODO the following is duplicated with the R-CMD-check.yaml workflow
2631
- uses: r-lib/actions/setup-r@v2
27-
# default r version: release
28-
# with:
29-
# use-public-rspm: true
30-
# r-version: ${{ matrix.config.r }}
32+
# default r version: release
33+
# with:
34+
# use-public-rspm: true
35+
# r-version: ${{ matrix.config.r }}
3136
- uses: r-lib/actions/setup-r-dependencies@v2
3237
with:
3338
extra-packages: any::pkgdown, local::.
3439
needs: website
3540
- uses: r-lib/actions/setup-tinytex@v2
3641
- uses: r-lib/actions/setup-pandoc@v2
42+
# end of duplication
3743
- name: Install package
3844
run: R CMD INSTALL .
3945
- name: Build website
4046
shell: Rscript {0}
4147
run: |
4248
pkgdown::build_site()
49+
# TODO only if we cannot publish to surge
4350
- name: Upload
4451
uses: actions/upload-artifact@v3
4552
with:
4653
name: documentation-${{github.sha}}
4754
path: docs
48-
49-
publish_preview:
50-
# on PR close, the 'generate' dependent job is skipped. So, without adding extra 'if' conditions, the job would be skipped as well
51-
# see https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#example-not-requiring-successful-dependent-jobs
52-
# TODO the following is NOT WORKING!!
53-
# if: github.event_name == 'pull_request' && (needs.generate.result == 'success' || needs.generate.result == 'skipped')
54-
if: github.event_name == 'pull_request' && always()
55-
runs-on: ubuntu-20.04
56-
needs: generate
57-
permissions:
58-
pull-requests: write # surge-preview: PR comments
59-
steps:
60-
- name: Download documentation
61-
if: github.event.action != 'closed'
62-
uses: actions/download-artifact@v3
63-
with:
64-
name: documentation-${{github.sha}}
6555
- uses: bonitasoft/actions/packages/surge-preview-tools@v1
6656
id: surge-preview-tools
6757
with:
@@ -76,3 +66,37 @@ jobs:
7666
failOnError: true
7767
teardown: 'true'
7868
build: echo 'already built!'
69+
70+
# generate:
71+
# if: github.event.action != 'closed' # on PR closed, only teardown the surge deployment
72+
#
73+
# publish_preview:
74+
# # on PR close, the 'generate' dependent job is skipped. So, without adding extra 'if' conditions, the job would be skipped as well
75+
# # see https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#example-not-requiring-successful-dependent-jobs
76+
# # TODO the following is NOT WORKING!!
77+
## if: github.event_name == 'pull_request' && (needs.generate.result == 'success' || needs.generate.result == 'skipped')
78+
# if: github.event_name == 'pull_request' && always()
79+
# runs-on: ubuntu-20.04
80+
# needs: generate
81+
# permissions:
82+
# pull-requests: write # surge-preview: PR comments
83+
# steps:
84+
# - name: Download documentation
85+
# if: github.event.action != 'closed'
86+
# uses: actions/download-artifact@v3
87+
# with:
88+
# name: documentation-${{github.sha}}
89+
# - uses: bonitasoft/actions/packages/surge-preview-tools@v1
90+
# id: surge-preview-tools
91+
# with:
92+
# surge-token: ${{ secrets.SURGE_TOKEN }}
93+
# - name: Manage surge preview
94+
# if: steps.surge-preview-tools.outputs.can-run-surge-command == 'true'
95+
# uses: afc163/surge-preview@v1
96+
# with:
97+
# surge_token: ${{ secrets.GITHUB_TOKEN }}
98+
# github_token: ${{ secrets.SURGE_TOKEN }}
99+
# dist: ./docs
100+
# failOnError: true
101+
# teardown: 'true'
102+
# build: echo 'already built!'

0 commit comments

Comments
 (0)