build.yml 3.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
  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: 21
  63. - name: Setup Gradle
  64. uses: gradle/actions/setup-gradle@db19848a5fa7950289d3668fb053140cf3028d43 # v3.3.2
  65. with:
  66. # gradle enterprise is used for the build cache
  67. gradle-home-cache-excludes: caches/build-cache-1
  68. - name: Build and publish artifact snapshots
  69. env:
  70. GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
  71. SONATYPE_USER: ${{ secrets.SONATYPE_USER }}
  72. SONATYPE_KEY: ${{ secrets.SONATYPE_KEY }}
  73. GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
  74. GPG_PASSWORD: ${{ secrets.GPG_PASSWORD }}
  75. run: ./gradlew assemble publishToSonatype
  76. - name: Build and publish gradle plugin snapshots
  77. env:
  78. GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
  79. SONATYPE_USER: ${{ secrets.SONATYPE_USER }}
  80. SONATYPE_KEY: ${{ secrets.SONATYPE_KEY }}
  81. GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
  82. GPG_PASSWORD: ${{ secrets.GPG_PASSWORD }}
  83. run: ./gradlew build publishToSonatype
  84. working-directory: gradle-plugins