-
Notifications
You must be signed in to change notification settings - Fork 47
48 lines (47 loc) · 1.59 KB
/
netlify-deploy-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
name: Netlify Deploy Preview
on:
pull_request_target:
branches:
- 'rel/**'
- master
paths:
- 'docs/**'
env:
GITHUB_PR_NUMBER: ${{ github.event.pull_request.number }}
NETLIFY_SITE_NAME: ${{ github.event.repository.name }}
jobs:
netlify-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Checkout
uses: actions/checkout@v3
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}
path: 'PR-tmp'
- name: Get only changed docs
run: |
rsync --delete -av PR-tmp/docs/content/en/ docs/content/en/
rm -rf PR-tmp
- name: Generate Versioned Docs
uses: gooddata/gooddata-python-sdk/.github/actions/hugo-build-versioned-action@master
with:
base-url: https://preview-${{ env.GITHUB_PR_NUMBER }}--${{ env.NETLIFY_SITE_NAME }}.netlify.app
keep-master: keep_master
fetch-from: upstream
- name: Publish
uses: netlify/actions/cli@master
with:
args: deploy -d docs/public --alias=preview-${{ env.GITHUB_PR_NUMBER }}
env:
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_PREVIEW_AUTH_TOKEN }}
- name: Comment PR
uses: thollander/actions-comment-pull-request@v2
with:
message: |
https://preview-${{ env.GITHUB_PR_NUMBER }}--${{ env.NETLIFY_SITE_NAME }}.netlify.app/