|
| 1 | +name: "Patch dependencies" |
| 2 | +description: | |
| 3 | + Patches direct dependencies of this project leveraging maven local to publish the results. |
| 4 | +
|
| 5 | + This workflow supports patching opentelemetry-java and opentelemetry-java-instrumentation repositories by executing |
| 6 | + the `patch.sh` script that will try to patch those repositories and after that will optionally test and then publish |
| 7 | + the artifacts to maven local. |
| 8 | + To add a patch you have to add a file in the `.github/patches/` directory with the name of the repository that must |
| 9 | + be patched. |
| 10 | + This action assumes that java was set correctly. |
| 11 | +inputs: |
| 12 | + run_tests: |
| 13 | + default: "false" |
| 14 | + required: false |
| 15 | + description: "If the workflow should run tests of the dependencies. Anything different than false will evaluate to true" |
| 16 | + branch: |
| 17 | + required: true |
| 18 | + description: "The branch where this patches are being applied e.g.: release/v1.21.x" |
| 19 | + gpg_private_key: |
| 20 | + description: "The gpg key used to sign the artifacts" |
| 21 | + required: true |
| 22 | + gpg_password: |
| 23 | + description: "The gpg key password" |
| 24 | + required: true |
| 25 | +runs: |
| 26 | + using: "composite" |
| 27 | + steps: |
| 28 | + - name: check patches |
| 29 | + run: | |
| 30 | + if [[ -f .github/patches/${{ inputs.branch }}/opentelemetry-java.patch ]]; then |
| 31 | + echo 'patch_otel_java=true' >> $GITHUB_ENV |
| 32 | + fi |
| 33 | + if [[ -f .github/patches/${{ inputs.branch }}/opentelemetry-java-instrumentation.patch ]]; then |
| 34 | + echo 'patch_otel_java_instrumentation=true' >> $GITHUB_ENV |
| 35 | + fi |
| 36 | + if [[ -f .github/patches/${{ inputs.branch }}/opentelemetry-java-contrib.patch ]]; then |
| 37 | + echo 'patch_otel_java_contrib=true' >> $GITHUB_ENV |
| 38 | + fi |
| 39 | + shell: bash |
| 40 | + |
| 41 | + - name: Clone and patch repositories |
| 42 | + run: .github/scripts/patch.sh "${{ inputs.branch }}" |
| 43 | + if: ${{ env.patch_otel_java == 'true' || |
| 44 | + env.patch_otel_java_instrumentation == 'true' || |
| 45 | + env.patch_otel_java_contrib == 'true' }} |
| 46 | + shell: bash |
| 47 | + |
| 48 | + - name: Build opentelemetry-java with tests |
| 49 | + uses: gradle/gradle-build-action@v2 |
| 50 | + if: ${{ env.patch_otel_java == 'true' && inputs.run_tests != 'false' }} |
| 51 | + with: |
| 52 | + arguments: build publishToMavenLocal |
| 53 | + build-root-directory: opentelemetry-java |
| 54 | + env: |
| 55 | + GPG_PRIVATE_KEY: ${{ inputs.gpg_private_key }} |
| 56 | + GPG_PASSWORD: ${{ inputs.gpg_password }} |
| 57 | + |
| 58 | + - name: Build opentelemetry-java |
| 59 | + uses: gradle/gradle-build-action@v2 |
| 60 | + if: ${{ env.patch_otel_java == 'true' && inputs.run_tests == 'false' }} |
| 61 | + with: |
| 62 | + arguments: publishToMavenLocal |
| 63 | + build-root-directory: opentelemetry-java |
| 64 | + env: |
| 65 | + GPG_PRIVATE_KEY: ${{ inputs.gpg_private_key }} |
| 66 | + GPG_PASSWORD: ${{ inputs.gpg_password }} |
| 67 | + |
| 68 | + - name: Build opentelemetry-java-contrib with tests |
| 69 | + uses: gradle/gradle-build-action@v2 |
| 70 | + if: ${{ env.patch_otel_java_contrib == 'true' && inputs.run_tests != 'false' }} |
| 71 | + with: |
| 72 | + arguments: build publishToMavenLocal |
| 73 | + build-root-directory: opentelemetry-java-contrib |
| 74 | + env: |
| 75 | + GPG_PRIVATE_KEY: ${{ inputs.gpg_private_key }} |
| 76 | + GPG_PASSWORD: ${{ inputs.gpg_password }} |
| 77 | + |
| 78 | + - name: Build opentelemetry-java-contrib |
| 79 | + uses: gradle/gradle-build-action@v2 |
| 80 | + if: ${{ env.patch_otel_java_contrib == 'true' && inputs.run_tests == 'false' }} |
| 81 | + with: |
| 82 | + arguments: publishToMavenLocal |
| 83 | + build-root-directory: opentelemetry-java-contrib |
| 84 | + env: |
| 85 | + GPG_PRIVATE_KEY: ${{ inputs.gpg_private_key }} |
| 86 | + GPG_PASSWORD: ${{ inputs.gpg_password }} |
| 87 | + |
| 88 | + - name: Build opentelemetry-java-instrumentation with tests |
| 89 | + uses: gradle/gradle-build-action@v2 |
| 90 | + if: ${{ env.patch_otel_java_instrumentation == 'true' && inputs.run_tests != 'false' }} |
| 91 | + with: |
| 92 | + arguments: check -x spotlessCheck publishToMavenLocal |
| 93 | + build-root-directory: opentelemetry-java-instrumentation |
| 94 | + env: |
| 95 | + GPG_PRIVATE_KEY: ${{ inputs.gpg_private_key }} |
| 96 | + GPG_PASSWORD: ${{ inputs.gpg_password }} |
| 97 | + |
| 98 | + - name: Build opentelemetry java instrumentation |
| 99 | + uses: gradle/gradle-build-action@v2 |
| 100 | + if: ${{ env.patch_otel_java_instrumentation == 'true' && inputs.run_tests == 'false' }} |
| 101 | + with: |
| 102 | + arguments: publishToMavenLocal |
| 103 | + build-root-directory: opentelemetry-java-instrumentation |
| 104 | + env: |
| 105 | + GPG_PRIVATE_KEY: ${{ inputs.gpg_private_key }} |
| 106 | + GPG_PASSWORD: ${{ inputs.gpg_password }} |
0 commit comments