diff --git a/.github/actions/setup-repo/action.yml b/.github/actions/setup-repo/action.yml
new file mode 100644
index 00000000..63270ab2
--- /dev/null
+++ b/.github/actions/setup-repo/action.yml
@@ -0,0 +1,18 @@
+name: Setup repo
+description: Runs all steps to setup the repo (install node_modules, build, etc...)
+inputs:
+ registry-token:
+ description: 'PAT to access registries'
+runs:
+ using: 'composite'
+ steps:
+ - uses: actions/checkout@v3
+ - name: Set up Bun
+ uses: oven-sh/setup-bun@v1
+ with:
+ bun-version: latest
+ - name: Install dependencies
+ run: bun install
+ env:
+ SDK_READ_ACCESS_TOKEN: ${{ secrets.SDK_READ_ACCESS_TOKEN }}
+ shell: bash
\ No newline at end of file
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
new file mode 100644
index 00000000..843c2808
--- /dev/null
+++ b/.github/workflows/lint.yml
@@ -0,0 +1,27 @@
+name: test code quality
+
+on:
+ pull_request:
+ push:
+ branches:
+ - main
+
+defaults:
+ run:
+ shell: bash
+
+jobs:
+ check-lint:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v3
+ - name: Set up Bun
+ uses: oven-sh/setup-bun@v1
+ with:
+ bun-version: latest
+ - name: Install dependencies
+ run: bun install
+ env:
+ SDK_READ_ACCESS_TOKEN: ${{ secrets.SDK_READ_ACCESS_TOKEN }}
+ - name: Lint merkl-api codebase
+ run: bun lint:ci
\ No newline at end of file
diff --git a/.github/workflows/update_production.yml b/.github/workflows/update_production.yml
new file mode 100644
index 00000000..ebce20de
--- /dev/null
+++ b/.github/workflows/update_production.yml
@@ -0,0 +1,56 @@
+name: Trigger production deployment
+
+on:
+ push:
+ tags:
+ - 'v[0-9]+.[0-9]+.[0-9]+'
+
+defaults:
+ run:
+ shell: bash
+
+jobs:
+ tag-image:
+ runs-on: ubuntu-latest
+ env:
+ IMAGE_URL: europe-west1-docker.pkg.dev/angle-artifacts/angle-docker-registry/merkl-app
+ steps:
+ - uses: 'google-github-actions/auth@v0'
+ with:
+ credentials_json: '${{ secrets.GCLOUD_SECRET_ARTIFACTS }}'
+ - name: Login to Docker
+ run: gcloud auth configure-docker europe-west1-docker.pkg.dev
+ - name: Pull and tag image
+ run: |
+ export SHORT_SHA=${GITHUB_SHA:0:7}
+ export VERSION=${GITHUB_REF#refs/tags/}
+ docker pull $IMAGE_URL:$SHORT_SHA
+ docker tag $IMAGE_URL:$SHORT_SHA $IMAGE_URL:$VERSION
+ docker push $IMAGE_URL:$VERSION
+ trigger-production-deployment:
+ runs-on: ubuntu-latest
+ needs: tag-image
+ steps:
+ - name: Install dependencies
+ run: |
+ sudo snap install yq
+ - name: Clone deployments repo
+ uses: actions/checkout@v3
+ with:
+ repository: AngleProtocol/deployments
+ token: ${{ secrets.ACCESS_TOKEN }}
+ path: deployments
+ - name: Modify config.production.yaml and push to deployments
+ run: |
+ cd deployments
+
+ export VERSION=${GITHUB_REF#refs/tags/}
+ yq -i '.merkl-app.version = strenv(VERSION)' ./config.production.yaml
+
+ git config --global user.email "baptiste@angle.money"
+ git config --global user.name "BaptistG"
+
+ git add ./config.production.yaml
+ git commit -m "Update config.production.yaml with merkl-app version $VERSION"
+
+ git push
diff --git a/.github/workflows/update_staging.yml b/.github/workflows/update_staging.yml
new file mode 100644
index 00000000..910caf67
--- /dev/null
+++ b/.github/workflows/update_staging.yml
@@ -0,0 +1,65 @@
+name: Build image and trigger staging deployment
+
+on:
+ workflow_dispatch:
+ push:
+ branches:
+ - main
+
+defaults:
+ run:
+ shell: bash
+
+jobs:
+ build-image:
+ runs-on: ubuntu-latest
+ env:
+ IMAGE_URL: europe-west1-docker.pkg.dev/angle-artifacts/angle-docker-registry/merkl-app
+ steps:
+ - uses: actions/checkout@v3
+ - uses: actions/setup-node@v3
+ with:
+ node-version: 18
+ - uses: 'google-github-actions/auth@v0'
+ with:
+ credentials_json: '${{ secrets.GCLOUD_SECRET_ARTIFACTS }}'
+ - name: Login to Docker
+ run: gcloud auth configure-docker europe-west1-docker.pkg.dev
+ - name: Build image
+ run: |
+ export SHORT_SHA=${GITHUB_SHA:0:7}
+ docker pull $IMAGE_URL:latest || true
+ docker build --build-arg SDK_READ_ACCESS_TOKEN=${{ secrets.SDK_READ_ACCESS_TOKEN }} --cache-from $IMAGE_URL:latest --tag $IMAGE_URL:$SHORT_SHA --tag $IMAGE_URL:latest .
+ - name: Push image
+ run: |
+ export SHORT_SHA=${GITHUB_SHA:0:7}
+ docker push $IMAGE_URL:$SHORT_SHA
+
+ trigger-staging-deployment:
+ runs-on: ubuntu-latest
+ needs: build-image
+ steps:
+ - name: Install dependencies
+ run: |
+ sudo snap install yq
+ - name: Clone deployments repo
+ uses: actions/checkout@v3
+ with:
+ repository: AngleProtocol/deployments
+ token: ${{ secrets.ACCESS_TOKEN }}
+ path: deployments
+ - name: Modify config.staging.yaml and push to deployments
+ run: |
+ cd deployments
+
+ export SHORT_SHA=${GITHUB_SHA:0:7}
+
+ yq -i '.merkl-app.version = strenv(SHORT_SHA)' ./config.staging.yaml
+
+ git config --global user.email "baptiste@angle.money"
+ git config --global user.name "BaptistG"
+
+ git add ./config.staging.yaml
+ git commit -m "Update config.staging.yaml with merkl-app version $SHORT_SHA"
+
+ git push
diff --git a/Dockerfile b/Dockerfile
index ad6dce88..e0468ec1 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -20,4 +20,6 @@ COPY tsconfig.json ./
COPY ./ ./
-CMD ["bun", "dev"]
\ No newline at end of file
+EXPOSE 5173
+
+CMD ["bun", "dev"]
diff --git a/app/root.tsx b/app/root.tsx
index 5b5dbd95..c3e95d08 100644
--- a/app/root.tsx
+++ b/app/root.tsx
@@ -2,9 +2,8 @@ import type { LinksFunction } from "@remix-run/node";
import { Links, Meta, Outlet, Scripts, ScrollRestoration } from "@remix-run/react";
import "./tailwind.css";
import { DAppProvider } from "dappkit";
+import config from "../merkl.config";
import styles from "./tailwind.css?url";
-import config from "../merkl.config"
-
export const links: LinksFunction = () => [
{ rel: "preconnect", href: "https://fonts.googleapis.com" },
diff --git a/app/routes/_merkl.(home).tsx b/app/routes/_merkl.(home).tsx
index 03c2d4cb..726ff9b4 100644
--- a/app/routes/_merkl.(home).tsx
+++ b/app/routes/_merkl.(home).tsx
@@ -1,6 +1,6 @@
import type { MetaFunction } from "@remix-run/node";
import { Outlet } from "@remix-run/react";
-import { type Coloring, Container, createColoring } from "dappkit";
+import { Container } from "dappkit";
import Heading from "src/components/composite/Heading";
import { http, createConfig } from "wagmi";
import { mainnet, sepolia } from "wagmi/chains";
diff --git a/app/routes/_merkl.action.$action.tsx b/app/routes/_merkl.action.$action.tsx
index 81dd6d84..00bccfb2 100644
--- a/app/routes/_merkl.action.$action.tsx
+++ b/app/routes/_merkl.action.$action.tsx
@@ -4,9 +4,7 @@ import { Container } from "dappkit";
import Heading from "src/components/composite/Heading";
import { type Action, actions, getAction } from "src/config/actions";
-export async function loader({
- params: { action: _action },
-}: LoaderFunctionArgs) {
+export async function loader({ params: { action: _action } }: LoaderFunctionArgs) {
const action = getAction(_action ?? "");
if (!action) throw new Error("Unknown action");
diff --git a/app/routes/_merkl.chain.$id.tsx b/app/routes/_merkl.chain.$id.tsx
index 1510d0fe..8ec52cd4 100644
--- a/app/routes/_merkl.chain.$id.tsx
+++ b/app/routes/_merkl.chain.$id.tsx
@@ -45,15 +45,18 @@ export function ErrorBoundary() {
const networks = useMemo(() => {
const a = Object.keys(chains);
- return Object.entries(chains).reduce((supported, [chainId, chain]) => {
- supported[chainId] = (
-
-
- {chain.label}
-
- );
- return supported;
- }, {} as { [C in ChainId]?: ReactNode });
+ return Object.entries(chains).reduce(
+ (supported, [chainId, chain]) => {
+ supported[chainId] = (
+
+
+ {chain.label}
+
+ );
+ return supported;
+ },
+ {} as { [C in ChainId]?: ReactNode },
+ );
}, []);
return (
@@ -63,7 +66,7 @@ export function ErrorBoundary() {
{/* We don't support this chain */}