debian.yml 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. name: Build Debian Package
  2. on:
  3. release:
  4. types: [published]
  5. workflow_dispatch:
  6. env:
  7. JAVA_VERSION: 17
  8. jobs:
  9. build:
  10. name: Build Debian Package
  11. runs-on: ubuntu-18.04
  12. steps:
  13. - uses: actions/checkout@v2
  14. with:
  15. fetch-depth: 0
  16. - name: Install build tools
  17. run: |
  18. sudo apt-get update
  19. sudo apt-get install debhelper devscripts dput
  20. - name: Setup Java
  21. uses: actions/setup-java@v2
  22. with:
  23. distribution: 'temurin'
  24. java-version: ${{ env.JAVA_VERSION }}
  25. cache: 'maven'
  26. - id: versions
  27. name: Apply version information
  28. run: |
  29. if [[ $GITHUB_REF == refs/tags/* ]]; then
  30. SEM_VER_STR=${GITHUB_REF##*/}
  31. mvn versions:set -DnewVersion=${SEM_VER_STR}
  32. else
  33. SEM_VER_STR=`mvn help:evaluate -Dexpression=project.version -q -DforceStdout`
  34. fi
  35. SEM_VER_NUM=`echo ${SEM_VER_STR} | sed -E 's/([0-9]+\.[0-9]+\.[0-9]+).*/\1/'`
  36. REVCOUNT=`git rev-list --count HEAD`
  37. echo "::set-output name=semVerStr::${SEM_VER_STR}"
  38. echo "::set-output name=semVerNum::${SEM_VER_NUM}"
  39. echo "::set-output name=revNum::${REVCOUNT}"
  40. echo "::set-output name=ppaVerStr::${SEM_VER_STR/-/\~}-${REVCOUNT}"
  41. - name: Validate Version
  42. uses: skymatic/semver-validation-action@v1
  43. with:
  44. version: ${{ steps.versions.outputs.semVerStr }}
  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: ${{ steps.versions.outputs.semVerStr }}
  65. VERSION_NUM: ${{ steps.versions.outputs.semVerNum }}
  66. REVISION_NUM: ${{ steps.versions.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@v2
  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: Run dput to beta repo
  99. if: startsWith(github.ref, 'refs/tags/')
  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