generated from greenelab/lab-website-template
-
Notifications
You must be signed in to change notification settings - Fork 0
58 lines (46 loc) · 1.46 KB
/
build-preview.yaml
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
55
56
57
58
name: build-preview
run-name: build pull request preview
on:
# run when called from another workflow
workflow_call:
# run if user manually requests it
workflow_dispatch:
# variables
env:
PREVIEWS_FOLDER: preview
permissions:
contents: write
pull-requests: write
jobs:
build-preview:
runs-on: ubuntu-latest
steps:
# for debugging
- uses: crazy-max/ghaction-dump-context@v2
- name: Checkout branch contents
uses: actions/checkout@v4
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.head_ref }}
- name: Install Ruby packages
if: github.event.action != 'closed'
uses: ruby/setup-ruby@v1.172.0
with:
ruby-version: "3.1"
bundler-cache: true
- name: Get Pages url
if: github.event.action != 'closed'
id: pages
uses: actions/configure-pages@v4
# for debugging
- if: runner.debug == '1'
uses: mxschmitt/action-tmate@v3
- name: Build preview version of site
if: github.event.action != 'closed'
run: |
JEKYLL_ENV=production bundle exec jekyll build --baseurl "${{ steps.pages.outputs.base_path || '' }}/${{ env.PREVIEWS_FOLDER }}/pr-${{ github.event.number }}"
- name: Commit preview to Pages branch
uses: rossjrw/pr-preview-action@v1.4.7
with:
source-dir: _site
umbrella-dir: ${{ env.PREVIEWS_FOLDER }}