release.yml 2.4 KB

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