debian.yml 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. name: Build Debian Package
  2. on:
  3. release:
  4. types: [published]
  5. workflow_dispatch:
  6. inputs:
  7. dput:
  8. description: 'Upload to PPA'
  9. required: true
  10. default: false
  11. type: boolean
  12. version:
  13. description: 'Version'
  14. required: false
  15. env:
  16. JAVA_VERSION: 19
  17. jobs:
  18. get-version:
  19. uses: ./.github/workflows/get-version.yml
  20. with:
  21. version: ${{ github.event.inputs.version }}
  22. build:
  23. name: Build Debian Package
  24. runs-on: ubuntu-20.04
  25. needs: [get-version]
  26. steps:
  27. - uses: actions/checkout@v3
  28. - name: Install build tools
  29. run: |
  30. sudo add-apt-repository ppa:coffeelibs/openjdk
  31. sudo apt-get update
  32. sudo apt-get install debhelper devscripts dput coffeelibs-jdk-19
  33. - name: Setup Java
  34. uses: actions/setup-java@v3
  35. with:
  36. distribution: 'zulu'
  37. java-version: ${{ env.JAVA_VERSION }}
  38. cache: 'maven'
  39. - id: versions
  40. name: Create PPA version string
  41. run: echo "ppaVerStr=${SEM_VER_STR/-/\~}-${REVCOUNT}" >> $GITHUB_OUTPUT
  42. env:
  43. SEM_VER_STR: ${{ needs.get-version.outputs.semVerStr }}
  44. REVCOUNT: ${{ needs.get-version.outputs.revNum }}
  45. - name: Run maven
  46. run: mvn -B clean package -Pdependency-check,linux -DskipTests
  47. - name: Create orig.tar.gz with common/ libs/ mods/
  48. run: |
  49. mkdir pkgdir
  50. cp -r target/libs pkgdir
  51. cp -r target/mods pkgdir
  52. cp -r dist/linux/common/ pkgdir
  53. cp target/cryptomator-*.jar pkgdir/mods
  54. tar -cJf cryptomator_${{ steps.versions.outputs.ppaVerStr }}.orig.tar.xz -C pkgdir .
  55. - name: Patch and rename pkgdir
  56. run: |
  57. cp -r dist/linux/debian/ pkgdir
  58. export RFC2822_TIMESTAMP=`date --rfc-2822`
  59. envsubst '${SEMVER_STR} ${VERSION_NUM} ${REVISION_NUM}' < dist/linux/debian/rules > pkgdir/debian/rules
  60. envsubst '${PPA_VERSION} ${RFC2822_TIMESTAMP}' < dist/linux/debian/changelog > pkgdir/debian/changelog
  61. find . -name "*.jar" >> pkgdir/debian/source/include-binaries
  62. mv pkgdir cryptomator_${{ steps.versions.outputs.ppaVerStr }}
  63. env:
  64. SEMVER_STR: ${{ needs.get-version.outputs.semVerStr }}
  65. VERSION_NUM: ${{ needs.get-version.outputs.semVerNum }}
  66. REVISION_NUM: ${{ needs.get-version.outputs.revNum }}
  67. PPA_VERSION: ${{ steps.versions.outputs.ppaVerStr }}-0ppa1
  68. - name: Prepare GPG-Agent for signing with key 615D449FE6E6A235
  69. run: |
  70. echo "${GPG_PRIVATE_KEY}" | gpg --batch --quiet --import
  71. echo "${GPG_PASSPHRASE}" | gpg --batch --quiet --passphrase-fd 0 --pinentry-mode loopback -u 615D449FE6E6A235 --dry-run --sign README.md
  72. env:
  73. GPG_PRIVATE_KEY: ${{ secrets.RELEASES_GPG_PRIVATE_KEY }}
  74. GPG_PASSPHRASE: ${{ secrets.RELEASES_GPG_PASSPHRASE }}
  75. - name: debuild
  76. run: |
  77. debuild -S -sa -d
  78. debuild -b -sa -d
  79. env:
  80. DEBSIGN_PROGRAM: gpg --batch --pinentry-mode loopback
  81. DEBSIGN_KEYID: 615D449FE6E6A235
  82. working-directory: cryptomator_${{ steps.versions.outputs.ppaVerStr }}
  83. - name: Create detached GPG signatures
  84. run: |
  85. gpg --batch --quiet --passphrase-fd 0 --pinentry-mode loopback -u 615D449FE6E6A235 --detach-sign -a cryptomator_*_amd64.deb
  86. - name: Upload artifacts
  87. uses: actions/upload-artifact@v3
  88. with:
  89. name: linux-deb-package
  90. path: |
  91. cryptomator_*.dsc
  92. cryptomator_*.orig.tar.xz
  93. cryptomator_*.debian.tar.xz
  94. cryptomator_*_source.buildinfo
  95. cryptomator_*_source.changes
  96. cryptomator_*_amd64.deb
  97. cryptomator_*.asc
  98. - name: Publish on PPA
  99. if: startsWith(github.ref, 'refs/tags/') || inputs.dput
  100. run: dput ppa:sebastian-stenzel/cryptomator-beta cryptomator_*_source.changes
  101. - name: Publish Debian package on GitHub Releases
  102. if: startsWith(github.ref, 'refs/tags/')
  103. uses: softprops/action-gh-release@v1
  104. with:
  105. fail_on_unmatched_files: true
  106. token: ${{ secrets.CRYPTOBOT_RELEASE_TOKEN }}
  107. files: |
  108. cryptomator_*_amd64.deb
  109. cryptomator_*.asc