diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..b267d4f --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,38 @@ +name: Release Obsidian plugin + +on: + push: + tags: + - "*" + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Use Node.js + uses: actions/setup-node@v3 + with: + node-version: "18.x" + + - name: Build plugin + run: | + npm install + npm run build + + - name: Create release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + tag="${GITHUB_REF#refs/tags/}" + + mkdir ${{ github.event.repository.name }} + cp main.js manifest.json README.md LICENSE ${{ github.event.repository.name }} + zip -r ${{ github.event.repository.name }}.zip ${{ github.event.repository.name }} + + gh release create "$tag" \ + --title "$tag" \ + --notes "Release $tag" \ + ${{ github.event.repository.name }}.zip main.js manifest.json \ No newline at end of file diff --git a/release.bat b/release.bat new file mode 100644 index 0000000..75d7253 --- /dev/null +++ b/release.bat @@ -0,0 +1,34 @@ +@echo off +setlocal + +echo Obsidian插件发布助手 + +set /p VERSION="请输入新版本号 (例如 1.0.1): " + +echo. +echo 正在更新版本号到 %VERSION%... +call npm version %VERSION% --no-git-tag-version + +echo. +echo 正在运行版本更新脚本... +node version-bump.mjs %VERSION% + +echo. +echo 正在提交更改... +git add . +git commit -m "版本 %VERSION%" + +echo. +echo 正在创建标签... +git tag -a "%VERSION%" -m "版本 %VERSION%" + +echo. +echo 正在推送更改和标签到GitHub... +git push +git push --tags + +echo. +echo 完成!GitHub Actions将自动构建并发布版本 %VERSION% +echo 请访问GitHub仓库查看发布状态。 + +pause \ No newline at end of file