build.yml 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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. markdown-lint-check:
  42. # release branches are excluded
  43. if: "!startsWith(github.ref_name, 'release/')"
  44. uses: ./.github/workflows/reusable-markdown-lint-check.yml
  45. misspell-check:
  46. # release branches are excluded to avoid unnecessary maintenance if new misspellings are added
  47. # to the misspell dictionary
  48. if: "!startsWith(github.ref_name, 'release/')"
  49. uses: ./.github/workflows/reusable-misspell-check.yml
  50. publish-snapshots:
  51. needs:
  52. # intentionally not blocking snapshot publishing on test-latest-deps, muzzle,
  53. # markdown-link-check, or misspell-check
  54. - common
  55. runs-on: ubuntu-latest
  56. # skipping release branches because the versions in those branches are not snapshots
  57. if: github.ref_name == 'main' && github.repository == 'open-telemetry/opentelemetry-java-instrumentation'
  58. steps:
  59. - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
  60. - name: Free disk space
  61. run: .github/scripts/gha-free-disk-space.sh
  62. - name: Set up JDK for running Gradle
  63. uses: actions/setup-java@9704b39bf258b59bc04b50fa2dd55e9ed76b47a8 # v4.1.0
  64. with:
  65. distribution: temurin
  66. java-version: 17.0.6
  67. - name: Build and publish artifact snapshots
  68. env:
  69. GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
  70. SONATYPE_USER: ${{ secrets.SONATYPE_USER }}
  71. SONATYPE_KEY: ${{ secrets.SONATYPE_KEY }}
  72. GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
  73. GPG_PASSWORD: ${{ secrets.GPG_PASSWORD }}
  74. uses: gradle/gradle-build-action@29c0906b64b8fc82467890bfb7a0a7ef34bda89e # v3.1.0
  75. with:
  76. arguments: assemble publishToSonatype
  77. # gradle enterprise is used for the build cache
  78. gradle-home-cache-excludes: caches/build-cache-1
  79. - name: Build and publish gradle plugin snapshots
  80. env:
  81. GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
  82. SONATYPE_USER: ${{ secrets.SONATYPE_USER }}
  83. SONATYPE_KEY: ${{ secrets.SONATYPE_KEY }}
  84. GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
  85. GPG_PASSWORD: ${{ secrets.GPG_PASSWORD }}
  86. uses: gradle/gradle-build-action@29c0906b64b8fc82467890bfb7a0a7ef34bda89e # v3.1.0
  87. with:
  88. build-root-directory: gradle-plugins
  89. arguments: build publishToSonatype
  90. # gradle enterprise is used for the build cache
  91. gradle-home-cache-excludes: caches/build-cache-1