Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V3 #207

Merged
merged 71 commits into from
May 31, 2024
Merged

V3 #207

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
333b2f8
wip
Candinya May 21, 2024
a4f48db
feat: split jsconfig
Candinya May 21, 2024
e7180c7
fix: missing leave favicon
Candinya May 21, 2024
ab463e0
wip
Candinya May 22, 2024
005ebca
chore: tweak last & next post button
Candinya May 22, 2024
153f7c1
feat: lint
Candinya May 22, 2024
b2e1deb
wip
Candinya May 22, 2024
90d60f0
chore: ignore built files
Candinya May 22, 2024
b460b67
wip
Candinya May 23, 2024
648e739
fix: add missing after footer injections
Candinya May 23, 2024
97a718d
chore: rename comments load function
Candinya May 23, 2024
47627cc
feat: expose color variables for external usages
Candinya May 23, 2024
bae8a8d
feat: add support for prismjs
Candinya May 23, 2024
2215c9d
feat: add missing comment
Candinya May 23, 2024
e46a04c
wip
Candinya May 24, 2024
99e0030
chore: bump qr-code-styling version to v1.6.0-rc.1
Candinya May 24, 2024
b23a9dc
feat: update auto-release ci
Candinya May 24, 2024
678838c
chore: update ci
Candinya May 25, 2024
793f900
chore: update readme
Candinya May 25, 2024
3809f25
chore: rename auto-release workflow
Candinya May 25, 2024
ca8b402
chore: tidy translations
Candinya May 25, 2024
ea6775f
chore: rename dir
Candinya May 25, 2024
3b216e9
chore: tweak style
Candinya May 25, 2024
bc8a54a
feat: optimize js
Candinya May 25, 2024
d734d39
feat: split breadcrumb component
Candinya May 25, 2024
95fb783
feat: remove outdated commentProvider
Candinya May 25, 2024
402d13f
feat: use let or const to replace var
Candinya May 25, 2024
e266ae1
chore: refractor tag widgets
Candinya May 26, 2024
7bb0e24
feat: optional donate & share for per post / page
Candinya May 26, 2024
8ab696b
chore: use for of for widgets
Candinya May 26, 2024
de3feae
Merge branch 'master' into v3
Candinya May 27, 2024
c94a5ad
chore: simplify arcive page post counter logic
Candinya May 27, 2024
acec4bc
feat: build test on 3 nodejs versions
Candinya May 27, 2024
f67ad19
feat: upload built artifacts
Candinya May 27, 2024
107a61d
chore: remove fossa
Candinya May 27, 2024
b04cfc5
chore: update readme & license
Candinya May 28, 2024
d182322
Revert "Add license scan report and status"
Candinya May 28, 2024
effeb53
chore: use table for readme lists
Candinya May 28, 2024
a2bd90b
chore: optimize search
Candinya May 28, 2024
6d4dea9
feat: optional pjax
Candinya May 28, 2024
c966eef
chore: update comments in default config file
Candinya May 28, 2024
fdcab6d
chore: split project credits into wiki (wip)
Candinya May 28, 2024
548782f
chore: update package description
Candinya May 28, 2024
b9dc02b
fix: itemprop case
Candinya May 29, 2024
190a12f
feat: get share info from meta tags
Candinya May 29, 2024
9f88fe9
feat: split scripts for modal into dedicated files
Candinya May 29, 2024
189c5bf
feat: optional viewerjs
Candinya May 29, 2024
04f3895
fix: use webp for image
Candinya May 29, 2024
eb59c96
chore: rename styles
Candinya May 29, 2024
2e81e1f
feat: optional nprogress
Candinya May 29, 2024
1172908
fix: itemprop copyrightNotice
Candinya May 29, 2024
aade055
chore: sync config demo
Candinya May 29, 2024
76c6dfe
chore: update demo configurations & site build workflow
Candinya May 29, 2024
f25e9e3
chore: split assets for demo site
Candinya May 29, 2024
8873e1e
chore(ci): no copy config
Candinya May 29, 2024
8ff79cf
chore: move kr-modal scripts
Candinya May 29, 2024
64fce28
chore: reorder share.js functions
Candinya May 29, 2024
8053f12
chore: move modals partial
Candinya May 29, 2024
5871dd7
fix: repo
Candinya May 29, 2024
00a44ae
feat: always inject canonical urls
Candinya May 29, 2024
e617798
chore: tidy generators
Candinya May 29, 2024
3eae439
fix: site url config in demo site deploy ci
Candinya May 29, 2024
9e5b4b4
chore: tweak post toc settings
Candinya May 30, 2024
5da27ae
fix: redirect before scroll finish caused undefined error
Candinya May 30, 2024
661bec5
chore: update readme
Candinya May 30, 2024
f194ea2
feat: optimize linklist tag
Candinya May 30, 2024
be2290d
feat: it's kr-linklist now
Candinya May 30, 2024
6a50d2f
chore: rename field
Candinya May 30, 2024
a1ce002
chore: tweak mobile nav
Candinya May 31, 2024
0dfadb2
chore: reorder mobile nav mount code
Candinya May 31, 2024
06365c1
chore: remove unused esbuild import
Candinya May 31, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
91 changes: 0 additions & 91 deletions .demo/_config.kratos-rebirth.yml

This file was deleted.

7 changes: 0 additions & 7 deletions .github/dependabot.yml

This file was deleted.

40 changes: 35 additions & 5 deletions .github/workflows/auto-release.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,49 @@
name: Release events
name: Auto Release

on:
push:
tags:
- 'v*'

jobs:
gpr_publish:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
registry-url: 'https://registry.npmjs.org'
- name: Publish to NPM

- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9

- name: Install deps
run: pnpm install --frozen-lockfile

- name: Build
run: pnpm build

- name: Publish stable release version (with default latest tag)
if: ${{ ! contains(github.ref_name, '-') }}
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN_CANDINYA }}

- name: Publish unstable pre-release version (with next tag)
if: ${{ contains(github.ref_name, '-') }} # Refer to Semantic Versioning , use a hyphen to split version code and pre-release identifier
run: npm publish --tag next
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN_CANDINYA }}

- name: Create release (draft)
uses: softprops/action-gh-release@v2
with:
name: "[${{ github.ref_name }}] (新的发布)"
generate_release_notes: true
draft: true
prerelease: ${{ contains(github.ref_name, '-') }}
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
117 changes: 58 additions & 59 deletions .github/workflows/build-demo.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,28 @@
# Build the demo site when new changes are commited.

name: Build Demo Site

# This will run when push events occur on master branch.
on:
push:
branches: [ master ]

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of container that the job will run in
runs-on: ubuntu-latest

# Environment virables
env:
SITE_URL: kr-demo.candinya.com

# Steps represent a sequence of tasks that will be executed as part of the job
steps:

# Setup Node.js env
- uses: actions/setup-node@v2.1.2
- uses: actions/setup-node@v4
with:
node-version: '16.x'

node-version: 'lts'

- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9
run_install: false

# Get Hexo test utils
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
repository: 'hexojs/hexo-theme-unit-test'

Expand All @@ -36,75 +31,79 @@ jobs:
run: mkdir themes

# Clone Kratos-Rebirth into themes dir
- name: Clone Kratos-Rebirth into themes dir
run: git clone --single-branch --branch master https://github.com/${GITHUB_REPOSITORY} ./themes/kratos-rebirth
- uses: actions/checkout@v4
with:
path: 'themes/kratos-rebirth'

# Clone Demo site configurations & assets into tmp
- uses: actions/checkout@v4
with:
repository: 'kratos-rebirth/demo-site-v3'
path: '/tmp/demo-site'

# Build fresh theme files
- name: Build theme files
run: |
cd ./themes/kratos-rebirth
pnpm install --frozen-lockfile
pnpm build

# Edit hexo site settings
- name: Edit Hexo site settings
run: |
sed -i "s/title: Hexo/title: Kratos-Rebirth/" "_config.yml"
sed -i "s/subtitle: ''/subtitle: A demo site of theme Kratos Rebirth/" "_config.yml"
sed -i "s/description: ''/description: A demo site of theme Kratos Rebirth/" "_config.yml"
sed -i "s/title: Hexo/title: 'Kratos : Rebirth'/" "_config.yml"
sed -i "s/subtitle: ''/subtitle: 一个可爱而现代的 Hexo 主题/" "_config.yml"
sed -i "s/description: ''/description: 欢迎使用这个主题,希望能给您带来美好的体验。/" "_config.yml"
sed -i "s/author: John Doe/author: Candinya/" "_config.yml"
sed -i "s/language:/language: zh-CN/" "_config.yml"
sed -i "s|url: http://yoursite.com|url: https://${SITE_URL}|" "_config.yml"
sed -i "s|url: http://example.com|url: https://demo.krt.moe|" "_config.yml"
sed -i "s|permalink: :year/:month/:day/:title/|permalink: posts/:title/|" "_config.yml"
sed -i "s/theme: landscape/theme: kratos-rebirth/" "_config.yml"

# Copy document
- name: Copy document
run: cp "themes/kratos-rebirth/Kratos-Rebirth-Manual.md" "source/_posts/Kratos-Rebirth-Manual.md"

# Pin document
- name: Pin document
run: |
sed '2 isticky: 1' -i source/_posts/Kratos-Rebirth-Manual.md

# Copy extended theme settings
- name: Copy extended theme settings
run: cp "themes/kratos-rebirth/.demo/_config.kratos-rebirth.yml" "_config.kratos-rebirth.yml"

run: mv "/tmp/demo-site/_config.kratos-rebirth.yml" "_config.kratos-rebirth.yml"

# Prepare assets
- name: Prepare assets
run: mv /tmp/demo-site/assets source/demo-assets

# Edit theme settings
- name: Edit theme settings
run: |
sed -i "s|clientID: 'GitHub Application Client ID'|clientID: ${{ secrets.GH_OAUTH_ID }}|" "_config.kratos-rebirth.yml"
sed -i "s|clientSecret: 'GitHub Application Client Secret'|clientSecret: ${{ secrets.GH_OAUTH_SECRET }}|" "_config.kratos-rebirth.yml"

# Set Pages CNAME file
- name: Set github pages CNAME file
run: |
touch "source/CNAME"
echo "${SITE_URL}" > source/CNAME

# Install Hexo env
- name: Install Hexo environment
run: npm install

# Install post-time-fix plugin
- name: Install post-time-fix plugin
run: npm install hexo-filter-date-from-git --save

# Setup git configs
- name: Setup git configs
run: |
git config --global user.name "Github Actions"
git config --global user.email "dev@candinya.com"
# Set private key for deployment
mkdir -p ~/.ssh/
echo "${{ secrets.DEPLOY_KEY }}" | tr -d '\r' > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan github.com >> ~/.ssh/known_hosts

# Hexo build demo site
- name: Hexo build demo site
run: npx hexo generate --force

# Deploy demo site
- name: Deploy demo site
run: |
cd ./public
git init -b gh-pages
git remote add origin git@github.com:Candinya/Kratos-Rebirth-Demo.git
git add -A
git commit -m "Update Demo Site at `date +'%Y-%m-%d %H:%M:%S'`"
git push --set-upstream origin gh-pages -f

- name: Upload artifacts for pages
uses: actions/upload-pages-artifact@v3
with:
path: public

deploy:
needs: build

permissions:
pages: write
id-token: write

environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
39 changes: 30 additions & 9 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,32 @@

name: Build Test

on: pull_request
on:
pull_request:

jobs:
build:
strategy:
matrix:
node-version: [18, 20, 22]

runs-on: ubuntu-latest

steps:

# Setup Node.js env
- uses: actions/setup-node@v2.1.2
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

- name: Install pnpm
uses: pnpm/action-setup@v4
with:
node-version: '14.x'
version: 9
run_install: false

# Get Hexo test utils
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
repository: 'hexojs/hexo-theme-unit-test'

Expand All @@ -25,19 +36,22 @@ jobs:
run: mkdir themes

# Clone Kratos-Rebirth into themes dir
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
path: 'themes/kratos-rebirth'

# Build fresh theme files
- name: Build theme files
run: |
cd ./themes/kratos-rebirth
pnpm install --frozen-lockfile
pnpm build

# Edit hexo site settings
- name: Edit Hexo Theme settings
run: |
sed -i "s/language:/language: zh-CN/" "_config.yml"
sed -i "s/theme: landscape/theme: kratos-rebirth/" "_config.yml"

# Copy theme settings
- name: Copy theme settings
run: cp "themes/kratos-rebirth/.demo/_config.kratos-rebirth.yml" "_config.kratos-rebirth.yml"

# Install Hexo env
- name: Install Hexo environment
Expand All @@ -46,3 +60,10 @@ jobs:
# Hexo build demo site
- name: Hexo build test
run: npx hexo generate

- name: Upload built as artifacts
uses: actions/upload-artifact@v4
with:
name: test-node${{ matrix.node-version }}
path: public
retention-days: 1
Loading