build.yml 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. name: Build
  2. on:
  3. push:
  4. pull_request_target:
  5. types: [labeled]
  6. env:
  7. JAVA_VERSION: 19
  8. defaults:
  9. run:
  10. shell: bash
  11. jobs:
  12. test:
  13. name: Compile and Test
  14. runs-on: ubuntu-latest
  15. steps:
  16. - uses: actions/checkout@v3
  17. - uses: actions/setup-java@v3
  18. with:
  19. distribution: 'zulu'
  20. java-version: ${{ env.JAVA_VERSION }}
  21. cache: 'maven'
  22. - name: Cache SonarCloud packages
  23. uses: actions/cache@v3
  24. with:
  25. path: ~/.sonar/cache
  26. key: ${{ runner.os }}-sonar
  27. restore-keys: ${{ runner.os }}-sonar
  28. - name: Build and Test
  29. run: >
  30. xvfb-run
  31. mvn -B verify
  32. jacoco:report
  33. org.sonarsource.scanner.maven:sonar-maven-plugin:sonar
  34. -Pcoverage,dependency-check
  35. -Dsonar.projectKey=cryptomator_cryptomator
  36. -Dsonar.organization=cryptomator
  37. -Dsonar.host.url=https://sonarcloud.io
  38. env:
  39. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
  40. SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
  41. - name: Sign source tarball with key 615D449FE6E6A235
  42. if: startsWith(github.ref, 'refs/tags/')
  43. run: |
  44. git archive --prefix="cryptomator-${{ github.ref_name }}/" -o "cryptomator-${{ github.ref_name }}.tar.gz" ${{ github.ref }}
  45. echo "${GPG_PRIVATE_KEY}" | gpg --batch --quiet --import
  46. echo "${GPG_PASSPHRASE}" | gpg --batch --quiet --passphrase-fd 0 --pinentry-mode loopback -u 615D449FE6E6A235 --detach-sign -a cryptomator-*.tar.gz
  47. env:
  48. GPG_PRIVATE_KEY: ${{ secrets.RELEASES_GPG_PRIVATE_KEY }}
  49. GPG_PASSPHRASE: ${{ secrets.RELEASES_GPG_PASSPHRASE }}
  50. - name: Draft a release
  51. if: startsWith(github.ref, 'refs/tags/')
  52. uses: softprops/action-gh-release@v1
  53. with:
  54. draft: true
  55. discussion_category_name: releases
  56. token: ${{ secrets.CRYPTOBOT_RELEASE_TOKEN }}
  57. generate_release_notes: true
  58. files: |
  59. cryptomator-*.tar.gz.asc
  60. fail_on_unmatched_files: true
  61. body: |-
  62. :construction: Work in Progress
  63. ---