Skip to content

Commit

Permalink
👷 Add deploy.yml script
Browse files Browse the repository at this point in the history
Signed-off-by: Pascal Marco Caversaccio <pascal.caversaccio@hotmail.ch>
  • Loading branch information
pcaversaccio committed Dec 16, 2023
1 parent a973672 commit 3dfa2dd
Show file tree
Hide file tree
Showing 5 changed files with 110 additions and 2 deletions.
77 changes: 77 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -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
32 changes: 32 additions & 0 deletions interface/next.config.js
Original file line number Diff line number Diff line change
@@ -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;
Empty file added interface/public/.nojekyll
Empty file.
1 change: 0 additions & 1 deletion interface/src/components/layout/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ export const Header = () => {
<span className="text-accent font-mono font-bold">
{SITE_NAME}
</span>
{/* <Image className="h-8 w-auto rounded-full sm:h-10" src={logo} alt="logo" /> */}
</Link>
</div>
<div>
Expand Down
2 changes: 1 addition & 1 deletion interface/src/pages/abi.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ const Abi = () => {
)}
>
<Image
src={tab.imgUri}
src={`/nextjs-github-pages/${tab.imgUri}`}
height={tab.imgSize === "sm" ? 16 : 20}
width={tab.imgSize === "sm" ? 16 : 20}
alt="JSON logo"
Expand Down

0 comments on commit 3dfa2dd

Please sign in to comment.