Skip to content

Commit e9519e3

Browse files
committed
docs: enable canary previews
1 parent 50bb7f8 commit e9519e3

File tree

2 files changed

+70
-6
lines changed

2 files changed

+70
-6
lines changed
+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# This workflow is triggered on push to the main branch
2+
# It builds the documentation and deploys it to the canary environment
3+
name: Canary Docs Preview
4+
5+
on:
6+
push:
7+
branches:
8+
- main
9+
10+
concurrency:
11+
group: ci-canary-docs-preview
12+
cancel-in-progress: true
13+
14+
env:
15+
TURBO_API: http://127.0.0.1:9080
16+
TURBO_TOKEN: this-is-not-a-secret
17+
TURBO_TEAM: myself
18+
19+
jobs:
20+
generate-preview-artifact:
21+
timeout-minutes: 10
22+
strategy:
23+
fail-fast: false
24+
runs-on: ubuntu-latest
25+
steps:
26+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
27+
- uses: ./.github/actions/setup
28+
with:
29+
github-token: ${{ secrets.GH_PACKAGES_ACCESS_TOKEN }}
30+
restore-broccoli-cache: true
31+
jobs: 4
32+
parallel-build: true
33+
with-cert: false
34+
install: true
35+
repo-token: ${{ secrets.GITHUB_TOKEN }}
36+
- name: Install Docs Dependencies
37+
run: bun preview-api-docs
38+
- name: Upload static files as artifact
39+
id: deployment
40+
uses: actions/upload-pages-artifact@v3 # or specific "vX.X.X" version tag for this action
41+
with:
42+
path: docs-viewer/projects/ember-api-docs/dist
43+
44+
deploy:
45+
needs: generate-preview-artifact
46+
environment:
47+
name: github-pages
48+
url: ${{ steps.deployment.outputs.page_url }}
49+
runs-on: ubuntu-latest
50+
steps:
51+
- name: Deploy to GitHub Pages
52+
id: deployment
53+
uses: actions/deploy-pages@v4
54+

docs-viewer/src/preview-docs.ts

+16-6
Original file line numberDiff line numberDiff line change
@@ -159,12 +159,22 @@ async function main() {
159159
// start the docs viewer
160160
////////////////////////
161161
//
162-
const proc2 = Bun.spawn(['pnpm', 'start'], {
163-
cwd: path.join(projectRoot, 'ember-api-docs'),
164-
env: process.env,
165-
stdio: ['inherit', 'inherit', 'inherit'],
166-
});
167-
await proc2.exited;
162+
if (process.env.CI) {
163+
log('CI environment detected, skipping docs viewer start, building instead');
164+
const proc2 = Bun.spawn(['pnpm', 'build'], {
165+
cwd: path.join(projectRoot, 'ember-api-docs'),
166+
env: process.env,
167+
stdio: ['inherit', 'inherit', 'inherit'],
168+
});
169+
await proc2.exited;
170+
} else {
171+
const proc2 = Bun.spawn(['pnpm', 'start'], {
172+
cwd: path.join(projectRoot, 'ember-api-docs'),
173+
env: process.env,
174+
stdio: ['inherit', 'inherit', 'inherit'],
175+
});
176+
await proc2.exited;
177+
}
168178
}
169179

170180
main();

0 commit comments

Comments
 (0)