hosted: upload sitemaps to posthog in ci (#130)
This commit is contained in:
parent
c779d83cda
commit
d23cad7abf
42
.github/workflows/sourcemaps.yml
vendored
Normal file
42
.github/workflows/sourcemaps.yml
vendored
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
name: Upload sourcemaps
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: sourcemaps-${{ github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
upload:
|
||||||
|
if: github.repository != 'every-app/open-seo'
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
env:
|
||||||
|
POSTHOG_SOURCEMAPS: "true"
|
||||||
|
POSTHOG_CLI_HOST: ${{ secrets.POSTHOG_CLI_HOST }}
|
||||||
|
POSTHOG_CLI_PROJECT_ID: ${{ secrets.POSTHOG_CLI_PROJECT_ID }}
|
||||||
|
POSTHOG_CLI_API_KEY: ${{ secrets.POSTHOG_CLI_API_KEY }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Setup pnpm
|
||||||
|
uses: pnpm/action-setup@v4
|
||||||
|
with:
|
||||||
|
version: 9
|
||||||
|
|
||||||
|
- name: Setup Node.js
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: 22
|
||||||
|
cache: pnpm
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: pnpm install --frozen-lockfile
|
||||||
|
|
||||||
|
- name: Build and upload sourcemaps
|
||||||
|
run: pnpm run sourcemaps:upload
|
||||||
1
.gitignore
vendored
1
.gitignore
vendored
@ -4,6 +4,7 @@ package-lock.json
|
|||||||
yarn.lock
|
yarn.lock
|
||||||
.dev.vars
|
.dev.vars
|
||||||
dist/
|
dist/
|
||||||
|
dist-sourcemaps/
|
||||||
.wrangler
|
.wrangler
|
||||||
/tmp
|
/tmp
|
||||||
|
|
||||||
|
|||||||
@ -13,6 +13,7 @@
|
|||||||
"lint:fix": "oxlint . --type-aware --fix",
|
"lint:fix": "oxlint . --type-aware --fix",
|
||||||
"preview": "npm run build && vite preview --port 3001",
|
"preview": "npm run build && vite preview --port 3001",
|
||||||
"deploy": "npm run db:migrate:prod && npm run build && wrangler deploy",
|
"deploy": "npm run db:migrate:prod && npm run build && wrangler deploy",
|
||||||
|
"sourcemaps:upload": "POSTHOG_SOURCEMAPS=true npm run build && pnpm dlx @posthog/cli sourcemap inject --directory ./dist-sourcemaps && pnpm dlx @posthog/cli sourcemap upload --directory ./dist-sourcemaps",
|
||||||
"cf-typegen": "wrangler types",
|
"cf-typegen": "wrangler types",
|
||||||
"types:check": "tsc --noEmit",
|
"types:check": "tsc --noEmit",
|
||||||
"format:check": "prettier --check .",
|
"format:check": "prettier --check .",
|
||||||
|
|||||||
@ -11,6 +11,7 @@ export default defineConfig(({ mode }) => {
|
|||||||
const port = env.PORT ? Number(env.PORT) : 3001;
|
const port = env.PORT ? Number(env.PORT) : 3001;
|
||||||
const showDevtools = env.VITE_SHOW_DEVTOOLS !== "false";
|
const showDevtools = env.VITE_SHOW_DEVTOOLS !== "false";
|
||||||
const allowedHosts = env.ALLOWED_HOST ? [env.ALLOWED_HOST] : undefined;
|
const allowedHosts = env.ALLOWED_HOST ? [env.ALLOWED_HOST] : undefined;
|
||||||
|
const emitSourcemaps = env.POSTHOG_SOURCEMAPS === "true";
|
||||||
|
|
||||||
return {
|
return {
|
||||||
envPrefix: ["VITE_", "AUTH_MODE", "POSTHOG_PUBLIC_KEY", "POSTHOG_HOST"],
|
envPrefix: ["VITE_", "AUTH_MODE", "POSTHOG_PUBLIC_KEY", "POSTHOG_HOST"],
|
||||||
@ -21,6 +22,10 @@ export default defineConfig(({ mode }) => {
|
|||||||
allowedHosts,
|
allowedHosts,
|
||||||
port,
|
port,
|
||||||
},
|
},
|
||||||
|
build: {
|
||||||
|
sourcemap: emitSourcemaps,
|
||||||
|
outDir: emitSourcemaps ? "dist-sourcemaps" : "dist",
|
||||||
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
showDevtools
|
showDevtools
|
||||||
? devtools({
|
? devtools({
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user