flathub.yml 3.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. name: Create PR for flathub
  2. on:
  3. release:
  4. types: [published]
  5. workflow_dispatch:
  6. inputs:
  7. tag:
  8. description: 'Release tag'
  9. required: true
  10. jobs:
  11. get-version:
  12. uses: ./.github/workflows/get-version.yml
  13. with:
  14. version: ${{ inputs.tag }}
  15. tarball:
  16. name: Determines tarball url and compute checksum
  17. runs-on: ubuntu-latest
  18. needs: [get-version]
  19. if: github.event_name == 'workflow_dispatch' || needs.get-version.outputs.versionType == 'stable'
  20. outputs:
  21. url: ${{ steps.url.outputs.url}}
  22. sha512: ${{ steps.sha512.outputs.sha512}}
  23. steps:
  24. - name: Determine tarball url
  25. id: url
  26. run: |
  27. URL="";
  28. if [[ -n "${{ inputs.tag }}" ]]; then
  29. URL="https://github.com/cryptomator/cryptomator/archive/refs/tags/${{ inputs.tag }}.tar.gz"
  30. else
  31. URL="https://github.com/cryptomator/cryptomator/archive/refs/tags/${{ github.event.release.tag_name }}.tar.gz"
  32. fi
  33. echo "url=${URL}" >> "$GITHUB_OUTPUT"
  34. - name: Download source tarball and compute checksum
  35. id: sha512
  36. run: |
  37. curl --silent --fail-with-body -L -H "Accept: application/vnd.github+json" ${{ steps.url.outputs.url }} --output cryptomator.tar.gz
  38. TARBALL_SHA512=$(sha512sum cryptomator.tar.gz | cut -d ' ' -f1)
  39. echo "sha512=${TARBALL_SHA512}" >> "$GITHUB_OUTPUT"
  40. flathub:
  41. name: Create PR for flathub
  42. runs-on: ubuntu-latest
  43. needs: [tarball, get-version]
  44. env:
  45. FLATHUB_PR_URL: tbd
  46. steps:
  47. - uses: actions/checkout@v4
  48. with:
  49. repository: 'flathub/org.cryptomator.Cryptomator'
  50. token: ${{ secrets.CRYPTOBOT_WINGET_TOKEN }}
  51. - name: Checkout release branch
  52. run: |
  53. git checkout -b release/${{ needs.get-version.outputs.semVerStr }}
  54. - name: Update build file
  55. run: |
  56. sed -i -e 's/VERSION: [0-9]\+\.[0-9]\+\.[0-9]\+.*/VERSION: ${{ needs.get-version.outputs.semVerStr }}/g' org.cryptomator.Cryptomator.yaml
  57. sed -i -e 's/sha512: [0-9A-Za-z_\+-]\{128\} #CRYPTOMATOR/sha512: ${{ needs.tarball.outputs.sha512 }} #CRYPTOMATOR/g' org.cryptomator.Cryptomator.yaml
  58. sed -i -e 's;url: https://github.com/cryptomator/cryptomator/archive/refs/tags/[^[:blank:]]\+;url: ${{ needs.tarball.outputs.url }};g' org.cryptomator.Cryptomator.yaml
  59. - name: Commit and push
  60. run: |
  61. git config user.name "${{ github.actor }}"
  62. git config user.email "${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com"
  63. git config push.autoSetupRemote true
  64. git stage .
  65. git commit -m "Prepare release ${{needs.get-version.outputs.semVerStr}}"
  66. git push
  67. - name: Create pull request
  68. run: |
  69. printf "> [!IMPORTANT]\n> Todos:\n> - [ ] Update maven dependencies\n> - [ ] Check for JDK update\n> - [ ] Check for JFX update" > pr_body.md
  70. PR_URL=$(gh pr create --title "Release ${{ needs.get-version.outputs.semVerStr }}" --body-file pr_body.md)
  71. echo "FLATHUB_PR_URL=$PR_URL" >> "$GITHUB_ENV"
  72. env:
  73. GH_TOKEN: ${{ secrets.CRYPTOBOT_WINGET_TOKEN }}
  74. - name: Slack Notification
  75. uses: rtCamp/action-slack-notify@v2
  76. if: github.event_name == 'release'
  77. env:
  78. SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
  79. SLACK_USERNAME: 'Cryptobot'
  80. SLACK_ICON: false
  81. SLACK_ICON_EMOJI: ':bot:'
  82. SLACK_CHANNEL: 'cryptomator-desktop'
  83. SLACK_TITLE: "Flathub release PR created for ${{ github.event.repository.name }} ${{ github.event.release.tag_name }} created."
  84. SLACK_MESSAGE: "See <${{ env.FLATHUB_PR_URL }}|PR> on how to proceed.>."
  85. SLACK_FOOTER: false
  86. MSG_MINIMAL: true