Skip to content

Commit

Permalink
ci: add release addon
Browse files Browse the repository at this point in the history
  • Loading branch information
YunYouJun committed Sep 15, 2024
1 parent 7c6108f commit e1f1525
Show file tree
Hide file tree
Showing 4 changed files with 105 additions and 12 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/release-addon.yml
Original file line number Diff line number Diff line change
@@ -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
23 changes: 12 additions & 11 deletions packages/valaxy-addon-lightgallery/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand All @@ -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.'
---
<!-- 相册样式 -->
<!-- The style of gallery -->
<VAGallery :photos="frontmatter.photos" />

<!-- 你也可以单独使用照片的样式 -->
<!-- You can also use the style of the photo separately -->
<VAPhoto :photo="frontmatter.photos[0]" />
```
46 changes: 46 additions & 0 deletions packages/valaxy-addon-lightgallery/README.zh-CN.md
Original file line number Diff line number Diff line change
@@ -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: 我想起那天夕阳下的奔跑
---
<!-- 相册样式 -->
<VAGallery :photos="frontmatter.photos" />

<!-- 你也可以单独使用照片的样式 -->
<VAPhoto :photo="frontmatter.photos[0]" />
```
2 changes: 1 addition & 1 deletion packages/valaxy-addon-lightgallery/package.json
Original file line number Diff line number Diff line change
@@ -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"
Expand Down

1 comment on commit e1f1525

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉 Published on https://yun.valaxy.site as production
🚀 Deployed on https://66e73247ef4f4a3d4cf87152--valaxy.netlify.app

Please sign in to comment.