build.yml 2.3 KB

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