build.yml 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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. test-latest-deps:
  14. # release branches are excluded
  15. # because any time a new library version is released to maven central it can fail
  16. # which requires unnecessary release branch maintenance, especially for patches
  17. if: "!startsWith(github.ref_name, 'release/')"
  18. uses: ./.github/workflows/reusable-test-latest-deps.yml
  19. secrets:
  20. GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
  21. muzzle:
  22. # release branches are excluded
  23. # because any time a new library version is released to maven central it can fail
  24. # which requires unnecessary release branch maintenance, especially for patches
  25. if: "!startsWith(github.ref_name, 'release/')"
  26. uses: ./.github/workflows/reusable-muzzle.yml
  27. shell-script-check:
  28. # release branches are excluded to avoid unnecessary maintenance if new shell checks are added
  29. if: "!startsWith(github.ref_name, 'release/')"
  30. uses: ./.github/workflows/reusable-shell-script-check.yml
  31. markdown-link-check:
  32. # release branches are excluded to avoid unnecessary maintenance if external links break
  33. # (and also because the README.md javaagent download link has to be updated on release branches
  34. # before the release download has been published)
  35. if: "!startsWith(github.ref_name, 'release/')"
  36. uses: ./.github/workflows/reusable-markdown-link-check.yml
  37. markdown-lint-check:
  38. # release branches are excluded
  39. if: "!startsWith(github.ref_name, 'release/')"
  40. uses: ./.github/workflows/reusable-markdown-lint-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@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
  56. - name: Free disk space
  57. run: .github/scripts/gha-free-disk-space.sh
  58. - name: Set up JDK for running Gradle
  59. uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1
  60. with:
  61. distribution: temurin
  62. java-version: 17.0.6
  63. - name: Build and publish artifact snapshots
  64. env:
  65. GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
  66. SONATYPE_USER: ${{ secrets.SONATYPE_USER }}
  67. SONATYPE_KEY: ${{ secrets.SONATYPE_KEY }}
  68. GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
  69. GPG_PASSWORD: ${{ secrets.GPG_PASSWORD }}
  70. uses: gradle/actions/setup-gradle@d0f2f0387e6ef0dce1fca38d0482617633e9d63a # v3.3.0
  71. with:
  72. arguments: assemble publishToSonatype
  73. # gradle enterprise is used for the build cache
  74. gradle-home-cache-excludes: caches/build-cache-1
  75. - name: Build and publish gradle plugin snapshots
  76. env:
  77. GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
  78. SONATYPE_USER: ${{ secrets.SONATYPE_USER }}
  79. SONATYPE_KEY: ${{ secrets.SONATYPE_KEY }}
  80. GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
  81. GPG_PASSWORD: ${{ secrets.GPG_PASSWORD }}
  82. uses: gradle/actions/setup-gradle@d0f2f0387e6ef0dce1fca38d0482617633e9d63a # v3.3.0
  83. with:
  84. build-root-directory: gradle-plugins
  85. arguments: build publishToSonatype
  86. # gradle enterprise is used for the build cache
  87. gradle-home-cache-excludes: caches/build-cache-1