diff --git a/.github/workflows/test-build-nextjs.yml b/.github/workflows/test-build-nextjs.yml new file mode 100644 index 00000000..4803e768 --- /dev/null +++ b/.github/workflows/test-build-nextjs.yml @@ -0,0 +1,61 @@ +# To not merge, if build fails +name: Test Next.js build + +on: + # For new PRs, or those who are ready and/or request a review + pull_request: + types: ["opened", "edited", "reopened", "synchronize", "ready_for_review", "review_requested"] + branches: ["main"] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages +permissions: + contents: read + pages: write + id-token: write + +# Allow one concurrent deployment +concurrency: + group: "test-build" + cancel-in-progress: true + +jobs: + test-build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup Node + uses: actions/setup-node@v3 + with: + node-version: "16" + cache: yarn + + - name: Setup Pages + uses: actions/configure-pages@v2 + with: + # Automatically inject basePath in your Next.js configuration file and disable + # server side image optimization (https://nextjs.org/docs/api-reference/next/image#unoptimized). + # + # You may remove this line if you want to manage the configuration yourself. + static_site_generator: next + + - name: Restore cache + uses: actions/cache@v3 + with: + path: | + .next/cache + # Generate a new cache whenever packages or source files change. + key: ${{ runner.os }}-nextjs-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }} + # If source files changed but packages didn't, rebuild from a prior cache. + restore-keys: | + ${{ runner.os }}-nextjs-${{ hashFiles('**/yarn.lock') }}- + + - name: Install dependencies + run: yarn install + + - name: Build documentation + run: yarn build-pages \ No newline at end of file diff --git a/next.config.js b/next.config.js index 981c53c7..5c4c379d 100644 --- a/next.config.js +++ b/next.config.js @@ -55,11 +55,12 @@ export default withNextra({ images: { unoptimized: true }, - i18n: { - // locales: ['en', 'zh'], - locales: ['en'], - defaultLocale: 'en' - }, + // i18n: { + // // locales: ['default', 'en', 'zh'], + // locales: ['default', 'en'], + // defaultLocale: 'default', + // // localeDetection: false, + // }, redirects: () => [ // Language→Guides pages are moved under Book section { diff --git a/package.json b/package.json index 5651acc8..8ac43b65 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,8 @@ "dev": "yarn clean && next", "build": "yarn clean && next build", "post-build": "echo 'spell checking, link checking, formatting'", - "build-pages": "yarn build && next export" + "build-pages": "yarn build && next export", + "next": "next" }, "devDependencies": { "@svgr/webpack": "^8.1.0", diff --git a/theme.config.jsx b/theme.config.jsx index 75f6eb51..fd229a43 100644 --- a/theme.config.jsx +++ b/theme.config.jsx @@ -35,10 +35,10 @@ const config = { link: 'https://github.com/tact-lang/tact-docs', }, docsRepositoryBase: 'https://github.com/tact-lang/tact-docs/edit/main/', - i18n: [ - { locale: 'en', text: 'English' }, - // { locale: 'zh', text: '中文' }, - ], + // i18n: [ + // { locale: 'en', text: 'English' }, + // // { locale: 'zh', text: '中文' }, + // ], sidebar: { autoCollapse: true, defaultMenuCollapseLevel: 1, @@ -47,15 +47,15 @@ const config = { feedback: { content: null }, - editLink: { - text: function useText() { - const { locale } = useRouter() - return { - 'en': 'Edit this page on GitHub', - // 'zh': '在 GitHub 上编辑此页', - }[locale ?? "en"] - } - }, + // editLink: { + // text: function useText() { + // const { locale } = useRouter() + // return { + // 'en': 'Edit this page on GitHub', + // // 'zh': '在 GitHub 上编辑此页', + // }[locale ?? "en"] + // } + // }, footer: { text: CC BY 4.0, Tact Software Foundation