diff --git a/.github/workflows/release-addon.yml b/.github/workflows/release-addon.yml new file mode 100644 index 0000000000..3a8d9d6d96 --- /dev/null +++ b/.github/workflows/release-addon.yml @@ -0,0 +1,46 @@ +name: Release Addon + +on: + push: + paths: + - 'packages/valaxy-addon-*/package.json' + +permissions: + contents: write + id-token: write + +jobs: + release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Install pnpm + uses: pnpm/action-setup@v2 + with: + run_install: true + + # after pnpm + - name: Use Node.js LTS + uses: actions/setup-node@v4 + with: + node-version: 'lts/*' + registry-url: https://registry.npmjs.org/ + cache: pnpm + + - name: Publish Addon + run: | + # Extract addon name from the commit message + COMMIT_MSG=${{ github.event.head_commit.message }} + if [[ $COMMIT_MSG == release(addon-*):* ]]; then + ADDON_NAME=$(echo $COMMIT_MSG | cut -d'(' -f2 | cut -d')' -f1) + # Change to the addon directory + cd packages/valaxy-$ADDON_NAME + # Publish the package + npm publish + fi + env: + NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} + NPM_CONFIG_PROVENANCE: true diff --git a/packages/valaxy-addon-lightgallery/README.md b/packages/valaxy-addon-lightgallery/README.md index 8b408c6458..572b502a14 100644 --- a/packages/valaxy-addon-lightgallery/README.md +++ b/packages/valaxy-addon-lightgallery/README.md @@ -2,21 +2,22 @@ [![NPM version](https://img.shields.io/npm/v/valaxy-addon-lightgallery?color=0078E7)](https://www.npmjs.com/package/valaxy-addon-lightgallery) -TODO: English Docs (PR Welcome) +- **English** | [简体中文](./README.zh-CN.md) -valaxy-addon-lightgallery 基于 [lightgallery](https://github.com/sachinchoolur/lightGallery) 提供画廊预览效果。 +valaxy-addon-lightgallery provides a gallery preview effect based on [lightgallery](https://github.com/sachinchoolur/lightGallery). -## 如何使用 +## How to use -### 安装依赖 +### Install dependencies ```bash npm i valaxy-addon-lightgallery ``` -### 加载插件 +### Load the plugin ```ts +// valaxy.config.ts import { defineValaxyConfig } from 'valaxy' import { addonLightGallery } from 'valaxy-addon-lightgallery' @@ -27,20 +28,20 @@ export default defineValaxyConfig({ }) ``` -### 在文章中直接使用 +### Use directly in the article -直接在 Markdown 中插入组件即可。 +Insert the component directly in Markdown. ```md --- photos: - - caption: 我 + - caption: Me src: https://cdn.jsdelivr.net/gh/YunYouJun/yun/images/meme/yun-good-alpha-compressed.png - desc: 我想起那天夕阳下的奔跑 + desc: 'I remember the run under the sunset that day.' --- - + - + ``` diff --git a/packages/valaxy-addon-lightgallery/README.zh-CN.md b/packages/valaxy-addon-lightgallery/README.zh-CN.md new file mode 100644 index 0000000000..82b68084a6 --- /dev/null +++ b/packages/valaxy-addon-lightgallery/README.zh-CN.md @@ -0,0 +1,46 @@ +# valaxy-addon-lightgallery + +[![NPM version](https://img.shields.io/npm/v/valaxy-addon-lightgallery?color=0078E7)](https://www.npmjs.com/package/valaxy-addon-lightgallery) + +- [English](./README.md) | **简体中文** + +valaxy-addon-lightgallery 基于 [lightgallery](https://github.com/sachinchoolur/lightGallery) 提供画廊预览效果。 + +## 如何使用 + +### 安装依赖 + +```bash +npm i valaxy-addon-lightgallery +``` + +### 加载插件 + +```ts +import { defineValaxyConfig } from 'valaxy' +import { addonLightGallery } from 'valaxy-addon-lightgallery' + +export default defineValaxyConfig({ + addons: [ + addonLightGallery(), + ], +}) +``` + +### 在文章中直接使用 + +直接在 Markdown 中插入组件即可。 + +```md +--- +photos: + - caption: 我 + src: https://cdn.jsdelivr.net/gh/YunYouJun/yun/images/meme/yun-good-alpha-compressed.png + desc: 我想起那天夕阳下的奔跑 +--- + + + + + +``` diff --git a/packages/valaxy-addon-lightgallery/package.json b/packages/valaxy-addon-lightgallery/package.json index 4c8dce9e4c..8489583d69 100644 --- a/packages/valaxy-addon-lightgallery/package.json +++ b/packages/valaxy-addon-lightgallery/package.json @@ -1,6 +1,6 @@ { "name": "valaxy-addon-lightgallery", - "version": "0.0.2", + "version": "0.0.3", "description": "Light Gallery for Valaxy", "repository": { "url": "https://github.com/YunYouJun/valaxy/tree/main/packages/valaxy-addon-lightgallery"