debian.yml 6.2 KB

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