Skip to content

Commit 8f40ec0

Browse files
ci: attempt bundle generation
Signed-off-by: venilinvasilev <[email protected]>
1 parent 796fe68 commit 8f40ec0

File tree

1 file changed

+58
-12
lines changed

1 file changed

+58
-12
lines changed

.github/workflows/api-version-check.yml

Lines changed: 58 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -46,24 +46,70 @@ jobs:
4646
- name: Install Dependencies
4747
run: pnpm install
4848

49-
- name: Build Base Commit
49+
- name: Install TypeScript and dts-bundle-generator
5050
run: |
51-
echo "Building base commit: ${{ github.event.pull_request.base.sha }}"
51+
pnpm add -D typescript
52+
pnpm add -g dts-bundle-generator ts-semver-detector
53+
54+
- name: Generate Base Commit Declarations
55+
run: |
56+
echo "Generating declarations for base commit: ${{ github.event.pull_request.base.sha }}"
5257
git checkout ${{ github.event.pull_request.base.sha }}
53-
task build
54-
cp lib/index.d.ts base.d.ts
55-
echo "Base build completed"
5658
57-
- name: Build Head Commit
59+
# Generate all declaration files using tsc
60+
npx tsc --declaration --emitDeclarationOnly --outDir temp/base-declarations
61+
62+
# Find the actual index.d.ts file location
63+
INDEX_FILE=$(find temp/base-declarations -name "index.d.ts" | head -1)
64+
if [ -z "$INDEX_FILE" ]; then
65+
echo "ERROR: index.d.ts not found in base declarations"
66+
find temp/base-declarations -name "*.d.ts" | head -10
67+
exit 1
68+
fi
69+
70+
echo "Found index.d.ts at: $INDEX_FILE"
71+
72+
# Bundle all declarations into a single file
73+
dts-bundle-generator \
74+
-o base.d.ts \
75+
"$INDEX_FILE" \
76+
--project tsconfig.json \
77+
--no-banner || {
78+
echo "ERROR: Failed to bundle base declarations"
79+
exit 1
80+
}
81+
82+
echo "Base declarations generated"
83+
84+
- name: Generate Head Commit Declarations
5885
run: |
59-
echo "Building head commit: ${{ github.event.pull_request.head.sha }}"
86+
echo "Generating declarations for head commit: ${{ github.event.pull_request.head.sha }}"
6087
git checkout ${{ github.event.pull_request.head.sha }}
61-
task build
62-
cp lib/index.d.ts head.d.ts
63-
echo "Head build completed"
6488
65-
- name: Install ts-semver-detector
66-
run: pnpm add -g ts-semver-detector
89+
# Generate all declaration files using tsc
90+
npx tsc --declaration --emitDeclarationOnly --outDir temp/head-declarations
91+
92+
# Find the actual index.d.ts file location
93+
INDEX_FILE=$(find temp/head-declarations -name "index.d.ts" | head -1)
94+
if [ -z "$INDEX_FILE" ]; then
95+
echo "ERROR: index.d.ts not found in head declarations"
96+
find temp/head-declarations -name "*.d.ts" | head -10
97+
exit 1
98+
fi
99+
100+
echo "Found index.d.ts at: $INDEX_FILE"
101+
102+
# Bundle all declarations into a single file
103+
dts-bundle-generator \
104+
-o head.d.ts \
105+
"$INDEX_FILE" \
106+
--project tsconfig.json \
107+
--no-banner || {
108+
echo "ERROR: Failed to bundle head declarations"
109+
exit 1
110+
}
111+
112+
echo "Head declarations generated"
67113
68114
- name: Check API Changes
69115
run: |

0 commit comments

Comments
 (0)