plugin-release.yml 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. name: Plugin Release
  2. on:
  3. workflow_dispatch:
  4. inputs:
  5. version:
  6. description: 'Plugin version to release, for example 5.5.4'
  7. required: true
  8. type: string
  9. release_notes:
  10. description: 'Release notes used in 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: Validate release metadata
  31. run: |
  32. python webnovel-writer/scripts/sync_plugin_version.py \
  33. --check \
  34. --expected-version "$RELEASE_VERSION"
  35. - name: Create and push tag
  36. run: |
  37. if git rev-parse "v$RELEASE_VERSION" >/dev/null 2>&1; then
  38. echo "Tag v$RELEASE_VERSION already exists"
  39. exit 1
  40. fi
  41. echo "Releasing commit $(git rev-parse HEAD) as v$RELEASE_VERSION"
  42. git tag "v$RELEASE_VERSION"
  43. git push origin "v$RELEASE_VERSION"
  44. - name: Create GitHub Release
  45. uses: softprops/action-gh-release@v2
  46. with:
  47. tag_name: v${{ inputs.version }}
  48. name: v${{ inputs.version }}
  49. body: ${{ inputs.release_notes }}