From 3dfa2ddf1b05be27335edb8d83390a23bb615b97 Mon Sep 17 00:00:00 2001 From: Pascal Marco Caversaccio Date: Sat, 16 Dec 2023 12:20:05 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=B7=20Add=20`deploy.yml`=20script?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Pascal Marco Caversaccio --- .github/workflows/deploy.yml | 77 ++++++++++++++++++++++ interface/next.config.js | 32 +++++++++ interface/public/.nojekyll | 0 interface/src/components/layout/Header.tsx | 1 - interface/src/pages/abi.tsx | 2 +- 5 files changed, 110 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/deploy.yml create mode 100644 interface/next.config.js create mode 100644 interface/public/.nojekyll diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 00000000..caf8c5aa --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,77 @@ +name: 🚀 Deploy Next.js UI to GitHub Pages + +on: + push: + branches: ["main"] + workflow_dispatch: + +# Allows only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. +# However, we do not cancel in-progress runs as we want to allow these production deployments to complete. +concurrency: + group: "pages" + cancel-in-progress: false + +jobs: + build: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: + - ubuntu-latest + node_version: + - 20 + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install pnpm + uses: pnpm/action-setup@v2 + with: + version: latest + run_install: false + + - name: Get pnpm cache directory path + id: pnpm-cache-dir-path + run: echo "dir=$(pnpm store path --silent)" >> $GITHUB_OUTPUT + + - name: Restore pnpm cache + uses: actions/cache@v3 + id: pnpm-cache + with: + path: ${{ steps.pnpm-cache-dir-path.outputs.dir }} + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-pnpm-store- + + - name: Use Node.js ${{ matrix.node_version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node_version }} + + - name: Build with Next.js + run: pnpm build:interface + + - name: Upload artifacts + uses: actions/upload-pages-artifact@v2 + with: + path: ./out + + deploy: + runs-on: ${{ matrix.os }} + needs: build + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + permissions: + pages: write + id-token: write + strategy: + matrix: + os: + - ubuntu-latest + + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v3 diff --git a/interface/next.config.js b/interface/next.config.js new file mode 100644 index 00000000..cdcb146a --- /dev/null +++ b/interface/next.config.js @@ -0,0 +1,32 @@ +// @ts-check + +/** + * @type {import('next').NextConfig} + **/ +const nextConfig = { + /** + * Enable static exports for the App Router. + * + * @see https://nextjs.org/docs/pages/building-your-application/deploying/static-exports + */ + output: "export", + + /** + * Set base path. This is usually the slug of your repository. + * + * @see https://nextjs.org/docs/app/api-reference/next-config-js/basePath + */ + basePath: "/createx", + + /** + * Disable server-based image optimization. Next.js does not support + * dynamic features with static exports. + * + * @see https://nextjs.org/docs/pages/api-reference/components/image#unoptimized + */ + images: { + unoptimized: true, + }, + }; + + module.exports = nextConfig; \ No newline at end of file diff --git a/interface/public/.nojekyll b/interface/public/.nojekyll new file mode 100644 index 00000000..e69de29b diff --git a/interface/src/components/layout/Header.tsx b/interface/src/components/layout/Header.tsx index cab2814b..21fa3c8d 100644 --- a/interface/src/components/layout/Header.tsx +++ b/interface/src/components/layout/Header.tsx @@ -54,7 +54,6 @@ export const Header = () => { {SITE_NAME} - {/* logo */}
diff --git a/interface/src/pages/abi.tsx b/interface/src/pages/abi.tsx index a907b568..dad475ea 100644 --- a/interface/src/pages/abi.tsx +++ b/interface/src/pages/abi.tsx @@ -175,7 +175,7 @@ const Abi = () => { )} >