debian.yml 6.8 KB

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