Skip to content

Commit

Permalink
chore: add deploy ci
Browse files Browse the repository at this point in the history
  • Loading branch information
Theo-Messi committed Aug 2, 2024
1 parent 46a9cff commit e95057c
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 9 deletions.
67 changes: 67 additions & 0 deletions .github/workflows/Deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Pages

on:
workflow_dispatch:
push:
branches:
- main # default branch

jobs:
pages:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20

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

- name: Install dependencies
run: pnpm install

- name: Build
run: pnpm run build

- name: Deploy
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: test/.vitepress/dist
cname: tmfe.theojs.cn

- name: Set DATE environment variable
run: echo "DATE=$(TZ='Asia/Shanghai' date +'%Y-%m-%d %H:%M:%S')" >> $GITHUB_ENV

- name: Translate job status to Chinese
id: translate-status
run: |
case "${{ job.status }}" in
success) translated_status="成功" ;;
failure) translated_status="失败" ;;
cancelled) translated_status="取消" ;;
*) translated_status="未知" ;;
esac
echo "translated_status=$translated_status" >> $GITHUB_ENV
- name: Notify job status
if: always() # 确保这一步始终运行,不管之前的步骤是否成功
run: |
curl -X "POST" "${{ secrets.BARK_KEY }}" \
-H 'Content-Type: application/json; charset=utf-8' \
-d '{
"body": "${{ github.repository }}于${{ env.DATE }}运行${{ env.translated_status }}",
"title": "Github Actions",
"badge": 1,
"category": "Github Actions",
"sound": "multiwayinvitation.caf",
"icon": "https://cdn.pixabay.com/photo/2022/01/30/13/33/github-6980894_1280.png",
"group": "Github Actions"
}'
8 changes: 5 additions & 3 deletions test/.vitepress/config.mts
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { defineConfig } from 'vitepress'

// https://vitepress.dev/reference/site-config
export default defineConfig({
title: "My Awesome Project",
description: "A VitePress Site",
title: "tmfe",
description: "vitepress beautification module",
cleanUrls: true,
head:[['link', { rel: 'icon', type: 'icon', href: '/avatar.png' }],],
themeConfig: {
logo: { src: '/avatar.png', width: 24, height: 24 },
nav: [
{ text: 'Home', link: '/' },
{ text: 'test', link: '/test' }
Expand Down
11 changes: 5 additions & 6 deletions test/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@
layout: home

hero:
name: "My Awesome Project"
text: "A VitePress Site"
tagline: My great project tagline
image:
src: https://ninja-squad.com/public/img/xvue-logo.png.pagespeed.ic.eVKfjlFdB4.png
name: "tmfe"
text: "vitepress beautification module"
# tagline: vitepress beautification module
image: ./avatar.png
prelink:
title: '🎉 站点迁移至 <u>https://doc.theojs.cn</u><div style="text-align: right; font-weight: bold;"><i class="fas fa-star" style="color: #FFD43B;"></i>Ctrl+D 快速收藏网址</div>'
title: '🎉 站点迁移至 <u>https://xxxxx</u><div style="text-align: right; font-weight: bold;"><i class="fas fa-star" style="color: #FFD43B;"></i>Ctrl+D 快速收藏网址</div>'
link: https://doc.theojs.cn/
target: _blank
actions:
Expand Down
Binary file added test/public/avatar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit e95057c

Please sign in to comment.