plugin-release.yml 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. name: Plugin Release
  2. on:
  3. workflow_dispatch:
  4. inputs:
  5. version:
  6. description: 'Plugin version to release, for example 5.5.2'
  7. required: true
  8. type: string
  9. release_notes:
  10. description: 'Release notes used in README and GitHub Release'
  11. required: true
  12. type: string
  13. permissions:
  14. contents: write
  15. jobs:
  16. release:
  17. runs-on: ubuntu-latest
  18. env:
  19. RELEASE_VERSION: ${{ inputs.version }}
  20. RELEASE_NOTES: ${{ inputs.release_notes }}
  21. steps:
  22. - name: Checkout
  23. uses: actions/checkout@v4
  24. with:
  25. fetch-depth: 0
  26. - name: Setup Python
  27. uses: actions/setup-python@v5
  28. with:
  29. python-version: '3.11'
  30. - name: Update release metadata
  31. run: |
  32. python webnovel-writer/scripts/sync_plugin_version.py \
  33. --version "$RELEASE_VERSION" \
  34. --release-notes "$RELEASE_NOTES"
  35. - name: Commit release metadata
  36. run: |
  37. git config user.name github-actions
  38. git config user.email github-actions[bot]@users.noreply.github.com
  39. git add README.md webnovel-writer/.claude-plugin/plugin.json .claude-plugin/marketplace.json
  40. git diff --cached --quiet && exit 0
  41. git commit -m "chore: release v$RELEASE_VERSION"
  42. git push origin HEAD
  43. - name: Create and push tag
  44. run: |
  45. if git rev-parse "v$RELEASE_VERSION" >/dev/null 2>&1; then
  46. echo "Tag v$RELEASE_VERSION already exists"
  47. exit 1
  48. fi
  49. git tag "v$RELEASE_VERSION"
  50. git push origin "v$RELEASE_VERSION"
  51. - name: Create GitHub Release
  52. uses: softprops/action-gh-release@v2
  53. with:
  54. tag_name: v${{ inputs.version }}
  55. name: v${{ inputs.version }}
  56. body: ${{ inputs.release_notes }}