-
Notifications
You must be signed in to change notification settings - Fork 25
67 lines (56 loc) · 2.15 KB
/
pages.yml
File metadata and controls
67 lines (56 loc) · 2.15 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
name: Deploy Trace Viewer Demo
on:
push:
branches: [main]
pull_request:
branches: [main]
permissions:
contents: write
concurrency:
group: pages-${{ github.ref }}
cancel-in-progress: true
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Build demo trace
run: cargo run --example realistic_workload
timeout-minutes: 5
- name: Assemble site
run: |
mkdir -p _site
cp dial9-tokio-telemetry/trace_viewer.html _site/trace_viewer.html
cp realistic_trace.bin _site/demo.bin
cp demo/index.html _site/index.html
- name: Deploy (main)
if: github.ref == 'refs/heads/main'
uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e # v4.0.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./_site
- name: Deploy (PR preview)
if: github.event_name == 'pull_request'
uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e # v4.0.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./_site
destination_dir: pr/${{ github.event.number }}
- name: Comment PR with preview link
if: github.event_name == 'pull_request'
uses: actions/github-script@v7
with:
script: |
const url = `https://${context.repo.owner}.github.io/${context.repo.repo}/pr/${context.issue.number}/`;
const body = `🔍 **Trace Viewer Preview:** ${url}`;
const { data: comments } = await github.rest.issues.listComments({
...context.repo, issue_number: context.issue.number
});
const existing = comments.find(c => c.body.includes('Trace Viewer Preview'));
if (existing) {
await github.rest.issues.updateComment({ ...context.repo, comment_id: existing.id, body });
} else {
await github.rest.issues.createComment({ ...context.repo, issue_number: context.issue.number, body });
}