-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #130 from JohnsonMao/develop
Develop
- Loading branch information
Showing
157 changed files
with
4,269 additions
and
3,003 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
name: CI Workflow | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.head_ref }} | ||
cancel-in-progress: true | ||
|
||
on: | ||
pull_request: | ||
branches-ignore: | ||
- 'main' | ||
paths: | ||
- 'src/**' | ||
workflow_dispatch: | ||
|
||
jobs: | ||
init: | ||
name: Initial common steps | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: 🛎️ Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: ⚙️ Setup PNPM | ||
uses: pnpm/action-setup@v2.2.1 | ||
with: | ||
version: 8 | ||
|
||
- name: 📝 Cache dependencies | ||
id: cache-deps | ||
uses: actions/cache@v3 | ||
with: | ||
path: node_modules | ||
key: deps-node-modules-${{ hashFiles('**/pnpm-lock.yaml') }} | ||
|
||
- name: 🔧 Install dependencies | ||
if: steps.cache-deps.outputs.cache-hit != 'true' | ||
run: pnpm install --frozen-lockfile | ||
|
||
test: | ||
name: Test Coverage | ||
runs-on: ubuntu-latest | ||
environment: Test | ||
timeout-minutes: 10 | ||
needs: init | ||
|
||
steps: | ||
- name: 🛎️ Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: ⚙️ Setup PNPM | ||
uses: pnpm/action-setup@v2.2.1 | ||
with: | ||
version: 8 | ||
|
||
- name: 📝 Cache dependencies | ||
id: cache-deps | ||
uses: actions/cache@v3 | ||
with: | ||
path: node_modules | ||
key: deps-node-modules-${{ hashFiles('**/pnpm-lock.yaml') }} | ||
|
||
- name: 🔧 Install dependencies | ||
if: steps.cache-deps.outputs.cache-hit != 'true' | ||
run: pnpm install --frozen-lockfile | ||
|
||
- name: 🧪 Test Coverage | ||
run: pnpm test:coverage | ||
|
||
- name: 📈 Upload coverage reports to Codecov | ||
uses: codecov/codecov-action@v3 | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
fail_ci_if_error: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
name: Cleanup Branch Resource | ||
|
||
permissions: | ||
actions: write | ||
contents: read | ||
|
||
on: | ||
pull_request: | ||
types: | ||
- closed | ||
workflow_dispatch: | ||
|
||
jobs: | ||
cleanup: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: 🛎️ Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: 🗑️ Cleanup cache | ||
run: | | ||
gh extension install actions/gh-actions-cache | ||
REPO=${{ github.repository }} | ||
BRANCH=refs/pull/${{ github.event.pull_request.number }}/merge | ||
echo "Fetching list of cache key" | ||
cacheKeysForPR=$(gh actions-cache list -R $REPO -B $BRANCH | cut -f 1 ) | ||
echo "Cache keys for PR: $cacheKeysForPR" | ||
## Setting this to not fail the workflow while deleting cache keys. | ||
set +e | ||
echo "Deleting caches..." | ||
for cacheKey in $cacheKeysForPR | ||
do | ||
echo "- ${cacheKey}" | ||
gh actions-cache delete $cacheKey -R $REPO -B $BRANCH --confirm | ||
done | ||
echo "Done" | ||
env: | ||
GH_TOKEN: ${{ github.token }} | ||
|
||
- name: ⚰️ Delete artifacts | ||
run: | | ||
PR_NUMBER=${{ github.event.pull_request.number }} | ||
artifacts=$(gh api /repos/${{ github.repository }}/actions/artifacts --paginate) | ||
for artifact in $(echo "$artifacts" | jq -r ".artifacts[] | select(.name | startswith(\"PR-$PR_NUMBER-\")) | .id"); do | ||
echo "filtered artifact: $artifact" | ||
gh api -X DELETE /repos/${{ github.repository }}/actions/artifacts/$artifact | ||
done | ||
env: | ||
GH_TOKEN: ${{ github.token }} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
export const defaultLocale = 'zh'; | ||
export const locales = [defaultLocale, 'en'] as const; | ||
export type Locale = (typeof locales)[number]; | ||
export type Dictionary = typeof import('./locales/zh.json'); | ||
|
||
const dictionaries: Record<Locale, () => Promise<Dictionary>> = { | ||
zh: () => import('./locales/zh.json'), | ||
en: () => import('./locales/en.json'), | ||
}; | ||
|
||
export const getDictionary = (locale: Locale) => dictionaries[locale](); | ||
|
||
export const isLocale = (language: string): language is Locale => | ||
locales.findIndex((locale) => locale === language) > -1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"common": { | ||
"home": "Home", | ||
"posts": "Posts", | ||
"about": "About", | ||
"tags": "Tags", | ||
"categories": "Categories", | ||
"latestPosts": "Latest Posts", | ||
"morePosts": "More Posts" | ||
}, | ||
"homePage": { | ||
"title": "Mao's Corner", | ||
"description": "Welcome to Mao's Learning Corner, where I document my study notes. Looking forward to exploring the vast realms of knowledge together with you." | ||
}, | ||
"postsPage": { | ||
"title": "Mao's Corner", | ||
"description": "Welcome to Mao's Learning Corner, where I document my study notes. Looking forward to exploring the vast realms of knowledge together with you." | ||
}, | ||
"notFound": { | ||
"message": "Sorry we couldn't find this page." | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"common": { | ||
"home": "首頁", | ||
"posts": "文章", | ||
"about": "關於", | ||
"tags": "標籤", | ||
"categories": "分類", | ||
"latestPosts": "最新文章", | ||
"morePosts": "更多文章" | ||
}, | ||
"homePage": { | ||
"title": "Mao's Corner", | ||
"description": "歡迎來到阿毛的學習角落,這裡記錄著我的學習筆記,期待與你一同探索廣闊的知識領域。" | ||
}, | ||
"postsPage": { | ||
"title": "Mao's Corner", | ||
"description": "歡迎來到阿毛的學習角落,這裡記錄著我的學習筆記,期待與你一同探索廣闊的知識領域。" | ||
}, | ||
"notFound": { | ||
"message": "抱歉!找不到此頁面。" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
968eb4e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
amao – ./
amao.vercel.app
amao-johnsonmao.vercel.app
amao-git-main-johnsonmao.vercel.app