build.yml 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. name: Build
  2. on:
  3. push:
  4. branches:
  5. - main
  6. - release/*
  7. workflow_dispatch:
  8. jobs:
  9. common:
  10. uses: ./.github/workflows/build-common.yml
  11. secrets:
  12. GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
  13. GE_CACHE_USERNAME: ${{ secrets.GE_CACHE_USERNAME }}
  14. GE_CACHE_PASSWORD: ${{ secrets.GE_CACHE_PASSWORD }}
  15. test-latest-deps:
  16. # release branches are excluded
  17. # because any time a new library version is released to maven central it can fail
  18. # which requires unnecessary release branch maintenance, especially for patches
  19. if: "!startsWith(github.ref_name, 'release/')"
  20. uses: ./.github/workflows/reusable-test-latest-deps.yml
  21. secrets:
  22. GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
  23. GE_CACHE_USERNAME: ${{ secrets.GE_CACHE_USERNAME }}
  24. GE_CACHE_PASSWORD: ${{ secrets.GE_CACHE_PASSWORD }}
  25. muzzle:
  26. # release branches are excluded
  27. # because any time a new library version is released to maven central it can fail
  28. # which requires unnecessary release branch maintenance, especially for patches
  29. if: "!startsWith(github.ref_name, 'release/')"
  30. uses: ./.github/workflows/reusable-muzzle.yml
  31. shell-script-check:
  32. # release branches are excluded to avoid unnecessary maintenance if new shell checks are added
  33. if: "!startsWith(github.ref_name, 'release/')"
  34. uses: ./.github/workflows/reusable-shell-script-check.yml
  35. markdown-link-check:
  36. # release branches are excluded to avoid unnecessary maintenance if external links break
  37. # (and also because the README.md javaagent download link has to be updated on release branches
  38. # before the release download has been published)
  39. if: "!startsWith(github.ref_name, 'release/')"
  40. uses: ./.github/workflows/reusable-markdown-link-check.yml
  41. misspell-check:
  42. # release branches are excluded to avoid unnecessary maintenance if new misspellings are added
  43. # to the misspell dictionary
  44. if: "!startsWith(github.ref_name, 'release/')"
  45. uses: ./.github/workflows/reusable-misspell-check.yml
  46. publish-snapshots:
  47. needs:
  48. # intentionally not blocking snapshot publishing on test-latest-deps, muzzle,
  49. # markdown-link-check, or misspell-check
  50. - common
  51. runs-on: ubuntu-latest
  52. # skipping release branches because the versions in those branches are not snapshots
  53. if: github.ref_name == 'main' && github.repository == 'open-telemetry/opentelemetry-java-instrumentation'
  54. steps:
  55. - uses: actions/checkout@v3
  56. - name: Set up JDK for running Gradle
  57. uses: actions/setup-java@v3
  58. with:
  59. distribution: temurin
  60. java-version: 17
  61. - name: Build and publish artifact snapshots
  62. env:
  63. GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
  64. SONATYPE_USER: ${{ secrets.SONATYPE_USER }}
  65. SONATYPE_KEY: ${{ secrets.SONATYPE_KEY }}
  66. GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
  67. GPG_PASSWORD: ${{ secrets.GPG_PASSWORD }}
  68. uses: gradle/gradle-build-action@v2
  69. with:
  70. arguments: assemble publishToSonatype
  71. # gradle enterprise is used for the build cache
  72. gradle-home-cache-excludes: caches/build-cache-1
  73. - name: Build and publish gradle plugin snapshots
  74. env:
  75. GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
  76. SONATYPE_USER: ${{ secrets.SONATYPE_USER }}
  77. SONATYPE_KEY: ${{ secrets.SONATYPE_KEY }}
  78. GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
  79. GPG_PASSWORD: ${{ secrets.GPG_PASSWORD }}
  80. uses: gradle/gradle-build-action@v2
  81. with:
  82. build-root-directory: gradle-plugins
  83. arguments: build publishToSonatype
  84. # gradle enterprise is used for the build cache
  85. gradle-home-cache-excludes: caches/build-cache-1