-
-
Notifications
You must be signed in to change notification settings - Fork 2
68 lines (60 loc) · 2.09 KB
/
docs-preview.yml
File metadata and controls
68 lines (60 loc) · 2.09 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
name: Docs Preview
on:
pull_request:
paths:
- 'docs/**'
- '.github/workflows/docs-preview.yml'
permissions:
contents: write
pull-requests: write
jobs:
preview:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
- name: Build Docs for Preview
working-directory: docs
env:
# Override base path for PR preview (no /cli prefix since preview domain is different)
DOCS_BASE_PATH: /pr-preview/pr-${{ github.event.pull_request.number }}
run: |
bun install --frozen-lockfile
bun run build
- name: Ensure .nojekyll at gh-pages root
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
# Try to fetch the gh-pages branch
if git fetch origin gh-pages:gh-pages 2>/dev/null; then
# Branch exists remotely, check if .nojekyll is present
if git show gh-pages:.nojekyll &>/dev/null; then
echo ".nojekyll already exists at gh-pages root"
else
echo "Adding .nojekyll to existing gh-pages branch"
git checkout gh-pages
touch .nojekyll
git add .nojekyll
git commit -m "Add .nojekyll to disable Jekyll processing"
git push origin gh-pages
git checkout -
fi
else
# Branch doesn't exist, create it as an orphan branch
echo "Creating gh-pages branch with .nojekyll"
git checkout --orphan gh-pages
git rm -rf .
touch .nojekyll
git add .nojekyll
git commit -m "Initialize gh-pages with .nojekyll"
git push origin gh-pages
git checkout -
fi
- name: Deploy Preview
uses: rossjrw/pr-preview-action@v1
with:
source-dir: docs/dist/
preview-branch: gh-pages
umbrella-dir: pr-preview
pages-base-url: cli.sentry.dev
action: auto