-
Notifications
You must be signed in to change notification settings - Fork 32
92 lines (75 loc) · 2.55 KB
/
preview.yml
File metadata and controls
92 lines (75 loc) · 2.55 KB
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
name: Preview trigger
on:
pull_request:
types: ["opened", "edited", "synchronize"]
pull_request_target:
types: [labeled]
jobs:
pr-preview:
if: |
(github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) ||
(github.event_name == 'pull_request_target' && github.event.label.name == 'preview')
name: "PR preview"
runs-on: ubuntu-latest
steps:
- name: Checkout questdb.com repository
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: "22"
cache: "yarn"
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Install Netlify CLI
run: npm install -g netlify-cli
- name: Build site
env:
CONTEXT: deploy-preview
NETLIFY: true
run: yarn build --out-dir build/docs
- name: Deploy to Netlify
id: netlify
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
run: |
PREVIEW_URL=$(netlify deploy \
--dir=build \
--no-build \
--auth=$NETLIFY_AUTH_TOKEN \
--site=$NETLIFY_SITE_ID \
--alias=preview-${{ github.event.pull_request.number }} \
--message="Preview Deploy from GitHub Actions" \
--json | jq -r '.deploy_url')
echo "NETLIFY_PREVIEW_URL=$PREVIEW_URL" >> $GITHUB_ENV
- name: "Update PR"
if: env.NETLIFY_PREVIEW_URL
uses: thollander/actions-comment-pull-request@v2
with:
message: |
:rocket: **Build success!**
Latest successful preview: ${{ env.NETLIFY_PREVIEW_URL }}/docs/
Commit SHA: ${{ github.event.pull_request.head.sha }}
> :package: Build generates a preview & updates link on each commit.
comment_tag: preview
validate-links:
name: "Validate broken links"
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: "22"
cache: "yarn"
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Build site for broken link validation
run: |
yarn build