debian.yml 4.5 KB

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