Skip to content

Commit bc6e3dc

Browse files
committed
Enhance deployment workflow and bundler error handling; add checks for existing runtime bundle
1 parent 3ae7520 commit bc6e3dc

2 files changed

Lines changed: 34 additions & 3 deletions

File tree

‎.github/workflows/deploy-docs.yml‎

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ permissions:
1010
contents: read
1111
pages: write
1212
id-token: write
13-
13+
1414
concurrency:
1515
group: 'pages'
1616
cancel-in-progress: false
@@ -20,11 +20,33 @@ jobs:
2020
name: Build Documentation
2121
runs-on: ubuntu-latest
2222
steps:
23-
- name: Checkout Code
23+
# 1. Checkout the documentation repository
24+
- name: Checkout Documentation
2425
uses: actions/checkout@v4
2526
with:
2627
fetch-depth: 0
2728

29+
# 2. Checkout the TypePHP core repository into ./typephp
30+
- name: Checkout TypePHP Core
31+
uses: actions/checkout@v4
32+
with:
33+
repository: typephp-php/typephp
34+
path: typephp
35+
36+
# 3. Setup PHP to install core dependencies
37+
- name: Setup PHP
38+
uses: shivammathur/setup-php@v2
39+
with:
40+
php-version: '8.3'
41+
tools: composer:v2
42+
43+
# 4. Install nikic/php-parser and phpstan/phpdoc-parser for bundling
44+
- name: Install TypePHP Dependencies
45+
run: |
46+
cd typephp
47+
composer install --no-dev --prefer-dist --no-progress --no-interaction
48+
49+
# 5. Setup Node.js for VitePress
2850
- name: Setup Node.js
2951
uses: actions/setup-node@v4
3052
with:
@@ -34,10 +56,13 @@ jobs:
3456
- name: Setup GitHub Pages
3557
uses: actions/configure-pages@v4
3658

37-
- name: Install Dependencies
59+
- name: Install Node Dependencies
3860
run: npm ci
3961

62+
# 6. Build docs with TYPEPHP_PATH pointing to the cloned core repo
4063
- name: Build with VitePress
64+
env:
65+
TYPEPHP_PATH: ${{ github.workspace }}/typephp
4166
run: npm run docs:build
4267

4368
- name: Upload Artifact

‎scripts/bundle-runtime.mjs‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ for (const candidate of searchPaths) {
2222
}
2323

2424
if (!typephpRepoPath) {
25+
if (fs.existsSync(outputFile)) {
26+
console.log('\x1b[33m[TypePHP Bundler]\x1b[0m Core repository not found, but existing runtime bundle was found.');
27+
console.log(` • Reusing pre-built bundle at: ${outputFile}`);
28+
process.exit(0);
29+
}
30+
2531
console.error('\x1b[31m[Bundle Error]\x1b[0m Could not locate the TypePHP core repository.');
2632
console.error('Searched in:', searchPaths);
2733
console.error('Please ensure the "typephp" repository is placed next to "typephp-docs" (e.g. ../typephp)');

0 commit comments

Comments
 (0)