-
Notifications
You must be signed in to change notification settings - Fork 5
fix(ci): release email workflow — public DB URL, no CI migrate #298
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
8bfbb50
e5e6e18
ff1351f
77532e6
637ddd5
ea8e989
1bc0d90
cf7bfdb
f612c9f
9fa8670
0e09426
e712313
0822280
4f6b8f5
4c96083
d71c8c3
0a31472
9503869
a90ef90
1ba4146
fc180bd
d559103
980d099
6b9307b
b39757e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,114 @@ | ||
| name: 'Upload Source Maps' | ||
| description: 'Uploads source maps to Telemetry-Tracker on release' | ||
| inputs: | ||
| session_cookie: | ||
| description: 'Dashboard session cookie for authentication' | ||
| required: true | ||
| project_id: | ||
| description: 'Telemetry-Tracker Project ID (X-Project-Id)' | ||
| required: true | ||
| release: | ||
| description: 'Release version/tag' | ||
| required: true | ||
| app: | ||
| description: 'Application name' | ||
| required: true | ||
| artifact_path: | ||
| description: 'Path to look for source map files recursively' | ||
| required: false | ||
| default: './dist' | ||
| base_url: | ||
| description: 'Base URL for your deployed JS bundles (e.g., https://example.com)' | ||
| required: true | ||
|
|
||
| runs: | ||
| using: 'composite' | ||
| steps: | ||
| - name: Upload maps via JSON API | ||
| shell: bash | ||
| run: | | ||
| node -e " | ||
| const fs = require('fs'); | ||
| const path = require('path'); | ||
| const http = require('https'); | ||
|
|
||
| function findFiles(dir) { | ||
| let results = []; | ||
| if (!fs.existsSync(dir)) return results; | ||
| const list = fs.readdirSync(dir); | ||
| list.forEach(file => { | ||
| file = path.join(dir, file); | ||
| const stat = fs.statSync(file); | ||
| if (stat && stat.isDirectory()) results = results.concat(findFiles(file)); | ||
| else if (file.endsWith('.map')) results.push(file); | ||
| }); | ||
| return results; | ||
| } | ||
|
|
||
| function uploadFile(filePath) { | ||
| return new Promise((resolve, reject) => { | ||
| const content = fs.readFileSync(filePath, 'utf8'); | ||
| const artifactPath = '${{ inputs.artifact_path }}'; | ||
| // 1. Get path relative to artifact_path | ||
| const resolvedArtifactPath = path.resolve(artifactPath); | ||
| const resolvedFilePath = path.resolve(filePath); | ||
| const relativePath = path.relative(resolvedArtifactPath, resolvedFilePath); | ||
| // 2. Remove .map to get the original JS path | ||
| const jsPath = relativePath.replace(/\.map$/, ''); | ||
| // 3. Build the full URL | ||
| const bundleUrl = \`\${{ inputs.base_url }}/\${jsPath}\`; | ||
|
|
||
| const payload = JSON.stringify({ | ||
| app: '${{ inputs.app }}', | ||
| release: '${{ inputs.release }}', | ||
| bundle_url: bundleUrl, | ||
| content: JSON.parse(content) | ||
| }); | ||
|
|
||
| const options = { | ||
| hostname: 'api.telemetry-tracker.com', | ||
| path: '/api/project/source-maps', | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hardcoded production API hostnameMedium Severity The upload step always posts to Reviewed by Cursor Bugbot for commit b39757e. Configure here. |
||
| method: 'POST', | ||
| headers: { | ||
| 'Content-Type': 'application/json', | ||
| 'X-Project-Id': '${{ inputs.project_id }}', | ||
| 'Cookie': '${{ inputs.session_cookie }}', | ||
| 'Content-Length': Buffer.byteLength(payload) | ||
| } | ||
| }; | ||
|
|
||
| const req = http.request(options, (res) => { | ||
| let body = ''; | ||
| res.on('data', chunk => body += chunk); | ||
| res.on('end', () => { | ||
| if (res.statusCode >= 400) { | ||
| reject(new Error(\`Failed to upload \${path.basename(filePath)}: \${res.statusCode} - \${body}\`)); | ||
| } else { | ||
| console.log(\`Successfully uploaded \${path.basename(filePath)}\`); | ||
| resolve(); | ||
| } | ||
| }); | ||
| }); | ||
|
|
||
| req.on('error', (e) => reject(e)); | ||
| req.write(payload); | ||
| req.end(); | ||
| }); | ||
| } | ||
|
|
||
| (async () => { | ||
| try { | ||
| const files = findFiles('${{ inputs.artifact_path }}'); | ||
| if (files.length === 0) { | ||
| console.log('No source maps found to upload.'); | ||
| return; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing maps exits successLow Severity When no Reviewed by Cursor Bugbot for commit b39757e. Configure here. |
||
| } | ||
| for (const file of files) { | ||
| await uploadFile(file); | ||
| } | ||
| } catch (err) { | ||
| console.error(err.message); | ||
| process.exit(1); | ||
| } | ||
| })(); | ||
| " | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -145,3 +145,29 @@ Symbolication is display-only; grouping fingerprints stay on raw minified stacks | |
| - [sdk-core.md](./sdk-core.md) — `trackError`, `release` in payloads | ||
| - [ARCHITECTURE.md](./ARCHITECTURE.md) — ingest pipeline | ||
| - [ENTITLEMENTS.md](./ENTITLEMENTS.md) — retention by plan tier | ||
|
|
||
| ## GitHub Action Workflow Example | ||
|
|
||
| You can automatically upload source maps on every release using our GitHub Action: | ||
|
|
||
| ```yaml | ||
| name: Release Configuration | ||
| on: | ||
| release: | ||
| types: [published] | ||
|
|
||
| jobs: | ||
| upload-maps: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Upload Source Maps | ||
| uses: ./.github/actions/upload-source-maps | ||
| with: | ||
| session_cookie: ${{ secrets.TT_SESSION_COOKIE }} | ||
| project_id: "your-project-uuid-here" | ||
| release: ${{ github.event.release.tag_name }} | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Release tag keeps v prefixMedium Severity The workflow example passes Additional Locations (1)Reviewed by Cursor Bugbot for commit b39757e. Configure here. |
||
| app: "my-telemetry-app" | ||
| artifact_path: "./dist" | ||
| base_url: "https://example.com" | ||
| ``` | ||


There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trailing slash doubles URL path
Medium Severity
bundle_urlis built as`${base_url}/${jsPath}`without normalizingbase_url. A trailing slash onbase_urlyields a double slash in the path, which can fail strict pathname matching during symbolication.Reviewed by Cursor Bugbot for commit b39757e. Configure here.