diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..deb2f73 --- /dev/null +++ b/.env.example @@ -0,0 +1,7 @@ +# Copy values from the matching existing environment. Do not commit real values. +VITE_ETH_CHAIN_ID= +VITE_ETH_DORA_ADDRESSS= +VITE_BRIDGE_CONTRACT_ADDRESS= +VITE_ETHERSCAN_URL= +VITE_MAINNET_RPC_URL= +VITE_SEPOLIA_RPC_URL= diff --git a/.github/workflows/vercel-build.yml b/.github/workflows/vercel-build.yml new file mode 100644 index 0000000..ce99f2a --- /dev/null +++ b/.github/workflows/vercel-build.yml @@ -0,0 +1,30 @@ +name: Vercel build validation +on: + pull_request: + branches: [main, dora-migrate-vota] + workflow_dispatch: +permissions: + contents: read +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: '24' + - name: Install locked dependencies + run: npx --yes pnpm@8.6.6 install --frozen-lockfile + - name: Build with the target environment + env: + TARGET_BRANCH: ${{ github.base_ref || github.ref_name }} + MAIN_ENV: ${{ secrets.ENV_CONTENTS_MAIN }} + DEV_ENV: ${{ secrets.ENV_CONTENTS }} + shell: bash + run: | + if [ "$TARGET_BRANCH" = main ]; then + printf '%s' "$MAIN_ENV" > .env + else + printf '%s' "$DEV_ENV" > .env + fi + npx --yes pnpm@8.6.6 run build diff --git a/.gitignore b/.gitignore index 1e81c07..73fc64b 100644 --- a/.gitignore +++ b/.gitignore @@ -23,3 +23,7 @@ dist-ssr *.njsproj *.sln *.sw? + +.vercel/ +.env.* +!.env.example diff --git a/.vercelignore b/.vercelignore new file mode 100644 index 0000000..094c26a --- /dev/null +++ b/.vercelignore @@ -0,0 +1,7 @@ +node_modules +dist +.git +.vercel +.env +.env.* +*.log diff --git a/docs/vercel-deployment.md b/docs/vercel-deployment.md new file mode 100644 index 0000000..0453914 --- /dev/null +++ b/docs/vercel-deployment.md @@ -0,0 +1,28 @@ +# Vercel deployment + +Both projects belong to the Dora Factory team (`dora-factory`). + +| Environment | Vercel project | Production branch | Existing domain | +| --- | --- | --- | --- | +| Mainnet | vota-migration | main | vota-migration.dorafactory.org | +| Development (Sepolia) | vota-migration-dev | dora-migrate-vota | test-bridge.dorafactory.org | + +Use the repository root, Vite, Node.js 24, pnpm 8.6.6, and `dist`. Commands and SPA fallback routing are defined in `vercel.json`. Each project uses Vercel Production with its own configuration; development is a separate application and branch, not the mainnet build in Preview mode. + +## Build environment + +Copy the appropriate existing GitHub secret (`ENV_CONTENTS_MAIN` or `ENV_CONTENTS`) into the matching Vercel project's Production environment variables. Do not mix environments or commit values. Vite embeds `VITE_` values in public browser assets: never put a server secret or a wallet private key in these variables. Keep the existing spelling `VITE_ETH_DORA_ADDRESSS`. + +Mainnet uses `VITE_MAINNET_RPC_URL`, `VITE_SEPOLIA_RPC_URL`, `VITE_ETH_CHAIN_ID`, `VITE_ETH_DORA_ADDRESSS`, `VITE_BRIDGE_CONTRACT_ADDRESS`, and `VITE_ETHERSCAN_URL`. Development uses `VITE_INFURA_API_KEY` instead of the two RPC URL variables. `.env.example` lists the active variables for this branch. Optional features should retain their existing environment configuration. + +The initial CLI migration recovered these active values from the JavaScript already served by the existing sites, because GitHub does not expose secret values. Other optional variables are unset in those published builds, including `VITE_PK_ENCRYPTION_KEY` and `VITE_DYDX_DENOM`; the migration keeps that behavior. This is not proof that their underlying GitHub secret files contain no unused settings. + +## Git and cutover + +Authorize the Vercel GitHub App for `DoraFactory/migration-user-interface`, connect both projects, and set the production branches shown above. If enabling previews, configure their variables deliberately to avoid accidentally using mainnet contracts in development. Restrict each project's production deployment to its corresponding branch. + +The original Docker/ECR/EKS workflow is retained during migration. The added workflow validates the Vercel build on pull requests; it does not deploy. After validating Git-triggered deployment, add the existing domains to their matching Vercel projects, back up DNS records, then change DNS to the exact records Vercel recommends. Remove the old EKS workflow in a separate cutover change, once rollback and domain checks are complete. + +## Validation + +The application uses HashRouter. Check homepage, `/#/terms`, `/#/privacy`, consent dialog, wallet-selection dialog, correct Ethereum chain ID, and token/bridge contract addresses. Read-only RPC checks do not validate signing, token approval, or a migration transaction. Do not use a live wallet transaction as a deployment smoke test. diff --git a/package.json b/package.json index 9155889..95203f5 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "version": "0.0.0", "type": "module", "engines": { - "node": ">=18" + "node": "24.x" }, "scripts": { "dev": "vite", diff --git a/vercel.json b/vercel.json new file mode 100644 index 0000000..a03a9ba --- /dev/null +++ b/vercel.json @@ -0,0 +1,13 @@ +{ + "$schema": "https://openapi.vercel.sh/vercel.json", + "framework": "vite", + "installCommand": "npx --yes pnpm@8.6.6 install --frozen-lockfile", + "buildCommand": "npx --yes pnpm@8.6.6 run build", + "outputDirectory": "dist", + "rewrites": [ + { + "source": "/(.*)", + "destination": "/index.html" + } + ] +}