11name : Build and deploy preview
22
3+ name : Build and deploy preview
4+
35on :
6+ workflow_dispatch : # To allow for manuel trigger of this workflow. Cf
7+ # https://docs.github.com/en/actions/reference/workflows-and-actions/events-that-trigger-workflows#workflow_dispatch
48 workflow_dispatch : # To allow for manuel trigger of this workflow. Cf
59 # https://docs.github.com/en/actions/reference/workflows-and-actions/events-that-trigger-workflows#workflow_dispatch
610 pull_request :
913 - reopened
1014 - synchronize # When the ref of the branch is updated (= commit to the branch to merge)
1115 - closed # Including closed to remove preview when PR is closed.
16+ - synchronize # When the ref of the branch is updated (= commit to the branch to merge)
17+ - closed # Including closed to remove preview when PR is closed.
1218 branches :
1319 - main # PR to main only
1420
21+ env :
22+ PREVIEW_BRANCH : gh-pages
23+ - main # PR to main only
24+
1525env :
1626 PREVIEW_BRANCH : gh-pages
1727
1828concurrency :
29+ group : preview-${{ github.ref }} # preview followed by the reference of the branch or tag that triggered the workflow
1930 group : preview-${{ github.ref }} # preview followed by the reference of the branch or tag that triggered the workflow
2031 cancel-in-progress : true
2132
2233jobs :
34+ build-render :
2335 build-render :
2436 if : github.event.action != 'closed' # If closing the PR, no publishing
2537 runs-on : ubuntu-latest
2638 # To cancel previous actions that could run on this PR
39+ # To cancel previous actions that could run on this PR
2740 steps :
2841 - name : Check out repository
42+ uses : actions/checkout@v5
2943 uses : actions/checkout@v5
3044 with :
3145 fetch-depth : 0 # To enable full access to Git repo
3246 ref : ${{ github.event.pull_request.head.ref }} # Reference of the commit to checkout to. To ensure it's the one of the PR
3347 repository : ${{github.event.pull_request.head.repo.full_name}} # Reference to the branch to checkout to. Useful with PR from forks
3448
49+
3550 # add software dependencies here and any libraries
3651 # See more at https://github.com/quarto-dev/quarto-actions/blob/main/examples/example-03-dependencies.md
3752 - name : Configure safe.directory # Workaround for actions/checkout#760
4055 - name : Install npm
4156 if : ${{ github.event.pull_request.head.repo.full_name == github.repository }}
4257 uses : actions/setup-node@v2
58+ uses : actions/setup-node@v2
4359 with :
4460 node-version : ' 18'
4561
6581 comment : false
6682 pr_number : ${{ github.event.pull_request.number }}
6783
84+ - name : Comment PR (custom)
85+ uses : marocchino/sticky-pull-request-comment@v2
86+ - name : Set up R
87+ uses : r-lib/actions/setup-r@v2
88+
89+ - name : Install babelquarto
90+ uses : r-lib/actions/setup-r-dependencies@v2
91+ with :
92+ packages : |
93+ github::ropensci-review-tools/babelquarto@a485fea
94+
95+ - name : Render bilingual project
96+ run : Rscript scripts/render.R
97+
98+ - name : Deploy preview
99+ id : deploy-preview
100+ 101+ with :
102+ source-dir : ./_site/
103+ preview-branch : ${{ env.PREVIEW_BRANCH }}
104+ action : deploy
105+ comment : false
106+ pr_number : ${{ github.event.pull_request.number }}
107+
68108 - name : Comment PR (custom)
69109 uses : marocchino/sticky-pull-request-comment@v2
70110 with :
@@ -88,10 +128,22 @@ jobs:
88128 - name : Remove preview
89129 id : remove-preview
90130131+ - name : Check out repository
132+ uses : actions/checkout@v5
91133 with :
134+ fetch-depth : 0 # To enable full access to Git repo
135+ ref : ${{ github.event.pull_request.head.ref }} # Reference of the commit to checkout to. To ensure it's the one of the PR
136+ repository : ${{github.event.pull_request.head.repo.full_name}} # Reference to the branch to checkout to. Useful with PR from forks
137+
138+ - name : Remove preview
139+ id : remove-preview
140+ 141+ with :
142+ action : remove
92143 action : remove
93144
94145 - name : Comment PR that preview was removed
146+ uses : marocchino/sticky-pull-request-comment@v2
95147 uses : marocchino/sticky-pull-request-comment@v2
96148 with :
97149 header : pr-preview
0 commit comments