Skip to content

Commit

Permalink
feat(deploy): add GitHub Actions workflow for deploying to GitHub Pages
Browse files Browse the repository at this point in the history
feat(config): set basePath for Next.js application
fix(Root): update routing to include leading slash
  • Loading branch information
vuonghuuhung committed Jan 12, 2025
1 parent 1e0b567 commit 9c54826
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 1 deletion.
52 changes: 52 additions & 0 deletions .github/workflows/deploy-github-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Deploy

on:
push:
branches:
- master

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout repo
uses: actions/checkout@v2

- name: Setup Node
uses: actions/setup-node@v1
with:
node-version: 20

- name: Install pnpm
run: npm install -g pnpm

- name: Install dependencies
run: pnpm install

- name: Build project
run: pnpm run build

- name: Upload production-ready build files
uses: actions/upload-artifact@v2
with:
name: production-files
path: ./dist

deploy:
runs-on: ubuntu-latest
needs: build
if: github.ref == 'refs/heads/master'

steps:
- name: Download artifact
uses: actions/download-artifact@v2
with:
name: production-files
path: ./dist

- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./dist
1 change: 1 addition & 0 deletions next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const withNextIntl = createNextIntlPlugin("./src/core/i18n/i18n.ts");

/** @type {import('next').NextConfig} */
const nextConfig = {
basePath: '/mini-app',
images: {
remotePatterns: [
{
Expand Down
2 changes: 1 addition & 1 deletion src/components/Root/Root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ function RootInner({ children }: PropsWithChildren) {
text={text}
selected={id === currentTab}
onClick={() => {
router.push(id);
router.push(`/${id}`);
}}
>
<Icon />
Expand Down

0 comments on commit 9c54826

Please sign in to comment.