Skip to content
This repository has been archived by the owner on Dec 12, 2024. It is now read-only.

fix[CI]: Added a new workflow and temporarily disabled i18n #83

Merged
merged 1 commit into from
Mar 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions .github/workflows/test-build-nextjs.yml
Original file line number Diff line number Diff line change
@@ -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
11 changes: 6 additions & 5 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
26 changes: 13 additions & 13 deletions theme.config.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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: <span>
CC BY 4.0, Tact Software Foundation
Expand Down
Loading