Skip to content

build(deps): bump @vueuse/core from 11.2.0 to 13.2.0 #99

build(deps): bump @vueuse/core from 11.2.0 to 13.2.0

build(deps): bump @vueuse/core from 11.2.0 to 13.2.0 #99

Workflow file for this run

name: Deploy to Target Repo on Version Change
on:
push:
paths:
- "package.json" # 仅在 package.json 更新时触发
jobs:
deploy:
runs-on: ubuntu-latest
steps:
# Step 1: 检出源仓库代码
- name: Checkout Source Repository
uses: actions/checkout@v3
with:
fetch-depth: 0 # 拉取完整历史记录
# Step 2: 检查 package.json 的版本号是否变化
- name: Check for Version Change
id: version
run: |
if [ "$(git rev-list --count HEAD)" -eq 1 ]; then
echo "No previous commit, setting version_changed to true."
echo "version_changed=true" >> $GITHUB_ENV
else
OLD_VERSION=$(git show HEAD~1:package.json | jq -r .version)
NEW_VERSION=$(jq -r .version package.json)
echo "Old version: $OLD_VERSION"
echo "New version: $NEW_VERSION"
if [ "$OLD_VERSION" != "$NEW_VERSION" ]; then
echo "version_changed=true" >> $GITHUB_ENV
else
echo "version_changed=false" >> $GITHUB_ENV
fi
fi
# Step 3: 如果版本号改变,则拉取目标仓库并执行 gh 指令
- name: Deploy to Target Repo
if: env.version_changed == 'true'
env:
TARGET_REPO_TOKEN: ${{ secrets.TARGET_REPO_TOKEN }}
run: |
# 克隆目标仓库
git clone https://x-access-token:${TARGET_REPO_TOKEN}@github.com/VueFilesPreview/vue-files-preview-demo.git vue-files-preview-demo
# 进入目标仓库目录
cd vue-files-preview-demo
# 安装依赖
npm install
# 确保脚本有执行权限
npm run gh
# 提交并推送更改(如果脚本有更改内容)
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add .
git commit -m "feat: Auto-deploy on version change to $NEW_VERSION" || echo "No changes to commit"
git push