push.yaml 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. name: Push
  2. run-name: ${{ github.ref_name }} push run 🚀
  3. on:
  4. push:
  5. branches:
  6. - master
  7. - main
  8. - 'release/**'
  9. tags:
  10. - '*'
  11. permissions:
  12. contents: write
  13. jobs:
  14. check-format:
  15. name: Check Formatting 🔍
  16. if: github.ref_name == 'master' || github.ref_name == 'main'
  17. uses: ./.github/workflows/check-format.yaml
  18. permissions:
  19. contents: read
  20. build-project:
  21. name: Build Project 🧱
  22. uses: ./.github/workflows/build-project.yaml
  23. secrets: inherit
  24. permissions:
  25. contents: read
  26. create-release:
  27. name: Create Release 🛫
  28. if: github.ref_type == 'tag'
  29. runs-on: ubuntu-24.04
  30. needs: build-project
  31. defaults:
  32. run:
  33. shell: bash
  34. steps:
  35. - name: Check Release Tag ☑️
  36. id: check
  37. run: |
  38. : Check Release Tag ☑️
  39. if [[ "${RUNNER_DEBUG}" ]]; then set -x; fi
  40. shopt -s extglob
  41. case "${GITHUB_REF_NAME}" in
  42. +([0-9]).+([0-9]).+([0-9]) )
  43. echo 'validTag=true' >> $GITHUB_OUTPUT
  44. echo 'prerelease=false' >> $GITHUB_OUTPUT
  45. echo "version=${GITHUB_REF_NAME}" >> $GITHUB_OUTPUT
  46. ;;
  47. +([0-9]).+([0-9]).+([0-9])-@(beta|rc)*([0-9]) )
  48. echo 'validTag=true' >> $GITHUB_OUTPUT
  49. echo 'prerelease=true' >> $GITHUB_OUTPUT
  50. echo "version=${GITHUB_REF_NAME}" >> $GITHUB_OUTPUT
  51. ;;
  52. *) echo 'validTag=false' >> $GITHUB_OUTPUT ;;
  53. esac
  54. - name: Download Build Artifacts 📥
  55. uses: actions/download-artifact@v4
  56. if: fromJSON(steps.check.outputs.validTag)
  57. id: download
  58. - name: Rename Files 🏷️
  59. if: fromJSON(steps.check.outputs.validTag)
  60. run: |
  61. : Rename Files 🏷️
  62. if [[ "${RUNNER_DEBUG}" ]]; then set -x; fi
  63. shopt -s extglob
  64. shopt -s nullglob
  65. root_dir="$(pwd)"
  66. commit_hash="${GITHUB_SHA:0:9}"
  67. variants=(
  68. 'windows-x64;zip|exe'
  69. 'macos-universal;tar.xz|pkg'
  70. 'ubuntu-24.04-x86_64;tar.xz|deb|ddeb'
  71. 'sources;tar.xz'
  72. )
  73. for variant_data in "${variants[@]}"; do
  74. IFS=';' read -r variant suffix <<< "${variant_data}"
  75. candidates=(*-${variant}-${commit_hash}/@(*|*-dbgsym).@(${suffix}))
  76. for candidate in "${candidates[@]}"; do
  77. mv "${candidate}" "${root_dir}"
  78. done
  79. done
  80. - name: Generate Checksums 🪪
  81. if: fromJSON(steps.check.outputs.validTag)
  82. run: |
  83. : Generate Checksums 🪪
  84. if [[ "${RUNNER_DEBUG}" ]]; then set -x; fi
  85. shopt -s extglob
  86. echo "### Checksums" > ${{ github.workspace }}/CHECKSUMS.txt
  87. for file in ${{ github.workspace }}/@(*.exe|*.deb|*.ddeb|*.pkg|*.tar.xz|*.zip); do
  88. echo " ${file##*/}: $(sha256sum "${file}" | cut -d " " -f 1)" >> ${{ github.workspace }}/CHECKSUMS.txt
  89. done
  90. - name: Create Release 🛫
  91. if: fromJSON(steps.check.outputs.validTag)
  92. id: create_release
  93. uses: softprops/action-gh-release@9d7c94cfd0a1f3ed45544c887983e9fa900f0564
  94. with:
  95. draft: true
  96. prerelease: ${{ fromJSON(steps.check.outputs.prerelease) }}
  97. tag_name: ${{ steps.check.outputs.version }}
  98. name: ${{ needs.build-project.outputs.pluginName }} ${{ steps.check.outputs.version }}
  99. body_path: ${{ github.workspace }}/CHECKSUMS.txt
  100. files: |
  101. ${{ github.workspace }}/*.exe
  102. ${{ github.workspace }}/*.zip
  103. ${{ github.workspace }}/*.pkg
  104. ${{ github.workspace }}/*.deb
  105. ${{ github.workspace }}/*.ddeb
  106. ${{ github.workspace }}/*.tar.xz