-
Notifications
You must be signed in to change notification settings - Fork 7
60 lines (51 loc) · 1.69 KB
/
Copy pathcheck_website.yaml
File metadata and controls
60 lines (51 loc) · 1.69 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
name: Check, build, and deploy the HONC docs website
on:
pull_request:
branches:
- "*"
paths:
- "docs/**"
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history for proper branch detection
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 9.11.0
run_install: false
- uses: actions/setup-node@v4
with:
node-version: lts/*
cache: "pnpm"
- name: Install dependencies
run: pnpm install
env:
CI: true
- name: Build website
run: pnpm build:docs
- name: Deploy preview
id: deploy
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
workingDirectory: ./docs
command: pages deploy ./dist --branch ${{ github.ref_name }}
- name: Comment PR
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const deployUrl = '${{ steps.deploy.outputs.deployment-url }}';
const aliasUrl = '${{ steps.deploy.outputs.pages-deployment-alias-url }}';
const { issue: { number: issueNumber }, repo: { owner, repo } } = context;
github.rest.issues.createComment({
owner,
repo,
issue_number: issueNumber,
body: `🚀 Preview deployment is ready!\n\n**Main URL:** [${deployUrl}](${deployUrl})\n**Branch-specific URL:** [${aliasUrl}](${aliasUrl})`
});