release.yml 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. name: release
  2. on:
  3. workflow_dispatch:
  4. push:
  5. branches:
  6. - master
  7. jobs:
  8. release:
  9. runs-on: ubuntu-latest
  10. permissions: write-all
  11. name: Release
  12. steps:
  13. - name: Checkout
  14. uses: actions/checkout@v4
  15. with:
  16. fetch-depth: 0
  17. - name: Check version
  18. id: version-check
  19. run: |
  20. chmod +x ./scripts/is-newer-version.bash
  21. chmod +x ./scripts/get-version.bash
  22. VERSION=$(./scripts/is-newer-version.bash)
  23. echo "version=${VERSION}" >> $GITHUB_OUTPUT
  24. if [ "$VERSION" != "0" ]; then
  25. echo "New version detected: $VERSION"
  26. else
  27. echo "No new version to release"
  28. fi
  29. - name: Push tag
  30. if: steps.version-check.outputs.version != '0'
  31. id: push-tag
  32. run: |
  33. tag="v${{ steps.version-check.outputs.version }}"
  34. git config user.name "${GITHUB_ACTOR}"
  35. git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
  36. git tag -a "${tag}" -m "Release ${tag}"
  37. git push origin "${tag}"
  38. echo "tag_name=${tag}" >> $GITHUB_OUTPUT
  39. - name: Checkout
  40. if: steps.version-check.outputs.version != '0'
  41. uses: actions/checkout@v4
  42. - name: Create release
  43. if: steps.version-check.outputs.version != '0'
  44. uses: ncipollo/release-action@v1
  45. with:
  46. generateReleaseNotes: true
  47. tag: "v${{ steps.version-check.outputs.version }}"
  48. artifacts: "./README.md"
  49. - name: Drop markdown.html
  50. uses: PJ-568/[email protected]
  51. - name: Setup Pages
  52. uses: actions/configure-pages@v4
  53. - name: Upload artifact
  54. uses: actions/upload-pages-artifact@v3
  55. with:
  56. path: './'
  57. - name: Deploy to GitHub Pages
  58. id: deployment
  59. uses: actions/deploy-pages@v4
  60. - name: Delete tag
  61. if: (cancelled() || failure()) && steps.push-tag.outputs.tag_name != ''
  62. run: |
  63. git config user.name "${GITHUB_ACTOR}"
  64. git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
  65. git push --delete origin "${{ steps.push-tag.outputs.tag_name }}"
  66. git tag -d "${{ steps.push-tag.outputs.tag_name }}"