debian.yml 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. name: Build Debian Package
  2. on:
  3. workflow_dispatch:
  4. inputs:
  5. semver:
  6. description: 'SemVer String (e.g. 1.7.0-beta1)'
  7. ppaver:
  8. description: 'Base PPA Version String (e.g. 1.6.16+1.7.0~beta1) without -0ppa1'
  9. dput:
  10. description: 'Upload to PPA'
  11. required: true
  12. default: false
  13. type: boolean
  14. push:
  15. paths:
  16. - '.github/workflows/debian.yml'
  17. - 'dist/linux/debian/**'
  18. - 'dist/linux/common/**'
  19. - 'dist/linux/resources/**'
  20. env:
  21. JAVA_DIST: 'temurin'
  22. JAVA_VERSION: '24.0.1+9'
  23. COFFEELIBS_JDK: 24
  24. COFFEELIBS_JDK_VERSION: '24.0.1+9-0ppa3'
  25. OPENJFX_JMODS_AMD64: 'https://download2.gluonhq.com/openjfx/24.0.1/openjfx-24.0.1_linux-x64_bin-jmods.zip'
  26. OPENJFX_JMODS_AMD64_HASH: '425fac742b9fbd095b2ce868cff82d1024620f747c94a7144d0a4879e756146c'
  27. OPENJFX_JMODS_AARCH64: 'https://download2.gluonhq.com/openjfx/24.0.1/openjfx-24.0.1_linux-aarch64_bin-jmods.zip'
  28. OPENJFX_JMODS_AARCH64_HASH: '7e02edd0f4ee5527a27c94b0bbba66fcaaff41009119e45d0eca0f96ddfb6e7b'
  29. jobs:
  30. get-version:
  31. uses: ./.github/workflows/get-version.yml
  32. with:
  33. version: ${{ inputs.semver }} #okay if not defined
  34. build:
  35. name: Build Debian Package
  36. runs-on: ubuntu-22.04
  37. needs: [get-version]
  38. steps:
  39. - uses: actions/checkout@v4
  40. - id: deb-version
  41. name: Determine deb-version
  42. run: |
  43. if [ -n "${{inputs.ppaver}}" ]; then
  44. echo "debVersion=${{inputs.ppaver }}" >> "$GITHUB_OUTPUT"
  45. else
  46. echo "debVersion=${{needs.get-version.outputs.semVerStr}}" >> "$GITHUB_OUTPUT"
  47. fi
  48. - name: Install build tools
  49. run: |
  50. sudo add-apt-repository ppa:coffeelibs/openjdk
  51. sudo apt-get update
  52. sudo apt-get install debhelper devscripts dput coffeelibs-jdk-${{ env.COFFEELIBS_JDK }}=${{ env.COFFEELIBS_JDK_VERSION }}
  53. - name: Setup Java
  54. uses: actions/setup-java@v4
  55. with:
  56. distribution: ${{ env.JAVA_DIST }}
  57. java-version: ${{ env.JAVA_VERSION }}
  58. check-latest: true
  59. cache: 'maven'
  60. - name: Run maven
  61. run: mvn -B clean package -Plinux -Djavafx.platform=linux -DskipTests
  62. - name: Download OpenJFX jmods
  63. id: download-jmods
  64. run: |
  65. curl -L ${{ env.OPENJFX_JMODS_AMD64 }} -o openjfx-amd64.zip
  66. echo "${{ env.OPENJFX_JMODS_AMD64_HASH }} openjfx-amd64.zip" | shasum -a256 --check
  67. mkdir -p jmods/amd64
  68. unzip -j openjfx-amd64.zip \*/javafx.base.jmod \*/javafx.controls.jmod \*/javafx.fxml.jmod \*/javafx.graphics.jmod -d jmods/amd64
  69. curl -L ${{ env.OPENJFX_JMODS_AARCH64 }} -o openjfx-aarch64.zip
  70. echo "${{ env.OPENJFX_JMODS_AARCH64_HASH }} openjfx-aarch64.zip" | shasum -a256 --check
  71. mkdir -p jmods/aarch64
  72. unzip -j openjfx-aarch64.zip \*/javafx.base.jmod \*/javafx.controls.jmod \*/javafx.fxml.jmod \*/javafx.graphics.jmod -d jmods/aarch64
  73. - name: Ensure major jfx version in pom and in jmods is the same
  74. run: |
  75. JMOD_VERSION_AMD64=$(jmod describe jmods/amd64/javafx.base.jmod | head -1)
  76. JMOD_VERSION_AMD64=${JMOD_VERSION_AMD64#*@}
  77. JMOD_VERSION_AMD64=${JMOD_VERSION_AMD64%%.*}
  78. JMOD_VERSION_AARCH64=$(jmod describe jmods/aarch64/javafx.base.jmod | head -1)
  79. JMOD_VERSION_AARCH64=${JMOD_VERSION_AARCH64#*@}
  80. JMOD_VERSION_AARCH64=${JMOD_VERSION_AARCH64%%.*}
  81. POM_JFX_VERSION=$(mvn help:evaluate "-Dexpression=javafx.version" -q -DforceStdout)
  82. POM_JFX_VERSION=${POM_JFX_VERSION#*@}
  83. POM_JFX_VERSION=${POM_JFX_VERSION%%.*}
  84. if [ $POM_JFX_VERSION -ne $JMOD_VERSION_AMD64 ]; then
  85. >&2 echo "Major JavaFX version in pom.xml (${POM_JFX_VERSION}) != amd64 jmod version (${JMOD_VERSION_AMD64})"
  86. exit 1
  87. fi
  88. if [ $POM_JFX_VERSION -ne $JMOD_VERSION_AARCH64 ]; then
  89. >&2 echo "Major JavaFX version in pom.xml (${POM_JFX_VERSION}) != aarch64 jmod version (${JMOD_VERSION_AARCH64})"
  90. exit 1
  91. fi
  92. - name: Create orig.tar.gz with common/ libs/ mods/ jmods/
  93. run: |
  94. mkdir pkgdir
  95. cp -r target/libs pkgdir
  96. cp -r target/mods pkgdir
  97. cp -r jmods pkgdir
  98. cp -r dist/linux/common/ pkgdir
  99. cp target/cryptomator-*.jar pkgdir/mods
  100. tar -cJf cryptomator_${{ steps.deb-version.outputs.debVersion }}.orig.tar.xz -C pkgdir .
  101. - name: Patch and rename pkgdir
  102. run: |
  103. cp -r dist/linux/debian/ pkgdir
  104. export RFC2822_TIMESTAMP=`date --rfc-2822`
  105. export DISABLE_UPDATE_CHECK=${{ inputs.dput }}
  106. envsubst '${SEMVER_STR} ${VERSION_NUM} ${REVISION_NUM} ${DISABLE_UPDATE_CHECK}' < dist/linux/debian/rules > pkgdir/debian/rules
  107. envsubst '${PPA_VERSION} ${RFC2822_TIMESTAMP}' < dist/linux/debian/changelog > pkgdir/debian/changelog
  108. find . -name "*.jar" >> pkgdir/debian/source/include-binaries
  109. mv pkgdir cryptomator_${{ steps.deb-version.outputs.debVersion }}
  110. env:
  111. SEMVER_STR: ${{ needs.get-version.outputs.semVerStr }}
  112. VERSION_NUM: ${{ needs.get-version.outputs.semVerNum }}
  113. REVISION_NUM: ${{ needs.get-version.outputs.revNum }}
  114. PPA_VERSION: ${{ steps.deb-version.outputs.debVersion }}-0ppa1
  115. - name: Prepare GPG-Agent for signing with key 615D449FE6E6A235
  116. run: |
  117. echo "${GPG_PRIVATE_KEY}" | gpg --batch --quiet --import
  118. echo "${GPG_PASSPHRASE}" | gpg --batch --quiet --passphrase-fd 0 --pinentry-mode loopback -u 615D449FE6E6A235 --dry-run --sign README.md
  119. env:
  120. GPG_PRIVATE_KEY: ${{ secrets.RELEASES_GPG_PRIVATE_KEY }}
  121. GPG_PASSPHRASE: ${{ secrets.RELEASES_GPG_PASSPHRASE }}
  122. - name: debuild
  123. run: |
  124. (sleep 8m; gpg --batch --quiet --pinentry-mode loopback -u 615D449FE6E6A235 --dry-run --sign README.md) &
  125. debuild -S -sa -d
  126. debuild -b -sa -d
  127. env:
  128. DEBSIGN_PROGRAM: gpg --batch --pinentry-mode loopback
  129. DEBSIGN_KEYID: 615D449FE6E6A235
  130. working-directory: cryptomator_${{ steps.deb-version.outputs.debVersion }}
  131. - name: Create detached GPG signatures
  132. run: |
  133. gpg --batch --quiet --passphrase-fd 0 --pinentry-mode loopback -u 615D449FE6E6A235 --detach-sign -a cryptomator_*_amd64.deb
  134. - name: Upload artifacts
  135. uses: actions/upload-artifact@v4
  136. with:
  137. name: linux-deb-package
  138. path: |
  139. cryptomator_*.dsc
  140. cryptomator_*.orig.tar.xz
  141. cryptomator_*.debian.tar.xz
  142. cryptomator_*_source.buildinfo
  143. cryptomator_*_source.changes
  144. cryptomator_*_amd64.deb
  145. cryptomator_*.asc
  146. - name: Publish on PPA
  147. if: inputs.dput && inputs.ppaver != ''
  148. run: dput ppa:sebastian-stenzel/cryptomator-beta cryptomator_*_source.changes
  149. # If ref is a tag, also upload to GitHub Releases:
  150. - name: Publish Debian package on GitHub Releases
  151. if: startsWith(github.ref, 'refs/tags/') && inputs.dput
  152. env:
  153. GITHUB_TOKEN: ${{ secrets.CRYPTOBOT_RELEASE_TOKEN }}
  154. run: |
  155. artifacts=$(ls | grep cryptomator*.deb)
  156. gh release upload ${{ github.ref_name }} $artifacts