Skip to content

Commit 572ecee

Browse files
committed
Initial SDK release
1 parent 0b356fd commit 572ecee

File tree

198 files changed

+150123
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

198 files changed

+150123
-0
lines changed

.github/workflows/publish.yml

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
# Publish workflow for xdk-typescript
2+
# Triggered by the generator repo via repository_dispatch
3+
# Also supports manual triggering for hotfixes
4+
5+
name: Publish to npm
6+
7+
on:
8+
repository_dispatch:
9+
types: [release]
10+
11+
workflow_dispatch:
12+
inputs:
13+
version:
14+
description: 'Version to publish (must match package.json)'
15+
required: true
16+
type: string
17+
18+
jobs:
19+
publish:
20+
name: Build and Publish
21+
runs-on: ubuntu-latest
22+
permissions:
23+
contents: write
24+
environment:
25+
name: npm
26+
url: https://www.npmjs.com/package/@xdevplatform/xdk
27+
28+
steps:
29+
- uses: actions/checkout@v4
30+
31+
- name: Get version
32+
id: version
33+
run: |
34+
if [ "${{ github.event_name }}" = "repository_dispatch" ]; then
35+
VERSION="${{ github.event.client_payload.version }}"
36+
else
37+
VERSION="${{ inputs.version }}"
38+
fi
39+
echo "version=$VERSION" >> $GITHUB_OUTPUT
40+
echo "📦 Publishing version: $VERSION"
41+
42+
- name: Verify version matches package.json
43+
run: |
44+
PKG_VERSION=$(node -p "require('./package.json').version")
45+
if [ "$PKG_VERSION" != "${{ steps.version.outputs.version }}" ]; then
46+
echo "❌ Version mismatch!"
47+
echo " package.json: $PKG_VERSION"
48+
echo " Requested: ${{ steps.version.outputs.version }}"
49+
exit 1
50+
fi
51+
echo "✅ Version verified: $PKG_VERSION"
52+
53+
- name: Setup Node.js
54+
uses: actions/setup-node@v4
55+
with:
56+
node-version: '20'
57+
registry-url: 'https://registry.npmjs.org'
58+
cache: 'npm'
59+
60+
- name: Install dependencies
61+
run: npm ci
62+
63+
- name: Build
64+
run: npm run build
65+
66+
- name: Run tests
67+
run: npm test
68+
69+
- name: Publish to npm
70+
run: npm publish
71+
env:
72+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
73+
74+
- name: Create Git tag
75+
run: |
76+
git config user.name "github-actions[bot]"
77+
git config user.email "github-actions[bot]@users.noreply.github.com"
78+
git tag -a "v${{ steps.version.outputs.version }}" -m "Release v${{ steps.version.outputs.version }}"
79+
git push origin "v${{ steps.version.outputs.version }}"
80+
81+
- name: Create GitHub Release
82+
uses: softprops/action-gh-release@v2
83+
with:
84+
tag_name: v${{ steps.version.outputs.version }}
85+
name: v${{ steps.version.outputs.version }}
86+
generate_release_notes: true
87+
draft: false
88+
prerelease: ${{ contains(steps.version.outputs.version, 'beta') || contains(steps.version.outputs.version, 'alpha') }}
89+
90+
- name: Summary
91+
run: |
92+
echo "# 🎉 Published to npm" >> $GITHUB_STEP_SUMMARY
93+
echo "" >> $GITHUB_STEP_SUMMARY
94+
echo "**Version:** \`${{ steps.version.outputs.version }}\`" >> $GITHUB_STEP_SUMMARY
95+
echo "" >> $GITHUB_STEP_SUMMARY
96+
echo "## Install" >> $GITHUB_STEP_SUMMARY
97+
echo "\`\`\`bash" >> $GITHUB_STEP_SUMMARY
98+
echo "npm install @xdevplatform/xdk@${{ steps.version.outputs.version }}" >> $GITHUB_STEP_SUMMARY
99+
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
100+
echo "" >> $GITHUB_STEP_SUMMARY
101+
echo "## Links" >> $GITHUB_STEP_SUMMARY
102+
echo "- [npm](https://www.npmjs.com/package/@xdevplatform/xdk/v/${{ steps.version.outputs.version }})" >> $GITHUB_STEP_SUMMARY
103+
echo "- [GitHub Release](https://github.com/${{ github.repository }}/releases/tag/v${{ steps.version.outputs.version }})" >> $GITHUB_STEP_SUMMARY
104+

.github/workflows/test.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Test workflow for xdk-typescript
2+
# Runs on every push and pull request
3+
4+
name: Test
5+
6+
on:
7+
push:
8+
branches: [main]
9+
pull_request:
10+
branches: [main]
11+
12+
jobs:
13+
test:
14+
name: Test Node.js ${{ matrix.node-version }}
15+
runs-on: ubuntu-latest
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
node-version: ['18', '20', '22']
20+
21+
steps:
22+
- uses: actions/checkout@v4
23+
24+
- name: Setup Node.js ${{ matrix.node-version }}
25+
uses: actions/setup-node@v4
26+
with:
27+
node-version: ${{ matrix.node-version }}
28+
cache: 'npm'
29+
30+
- name: Install dependencies
31+
run: npm ci
32+
33+
- name: Build
34+
run: npm run build
35+
36+
- name: Type check
37+
run: npm run type-check
38+
39+
- name: Lint
40+
run: npm run lint
41+
continue-on-error: true # Don't fail on lint errors for now
42+
43+
- name: Run tests
44+
run: npm test
45+
46+
- name: Run tests with coverage
47+
if: matrix.node-version == '20'
48+
run: npm run test:coverage
49+
50+
- name: Upload coverage
51+
if: matrix.node-version == '20'
52+
uses: codecov/codecov-action@v4
53+
with:
54+
files: coverage/lcov.info
55+
fail_ci_if_error: false
56+

0 commit comments

Comments
 (0)