123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223 |
- # Releases a patch by cherrypicking commits into a release branch based on the previous
- # release tag.
- name: Patch Release Build
- on:
- workflow_dispatch:
- inputs:
- version:
- description: The version to tag the release with, e.g., 1.2.1, 1.2.2
- required: true
- commits:
- description: Comma separated list of commit shas to cherrypick
- required: false
- jobs:
- prepare-release-branch:
- runs-on: ubuntu-latest
- outputs:
- release-branch-name: ${{ steps.parse-release-branch.outputs.release-branch-name }}
- steps:
- - id: parse-release-branch
- name: Parse release branch name
- run: |
- # Sets the release-branch-name output to the version number with the last non-period element replaced with an 'x' and preprended with v.
- echo "::set-output name=release-branch-name::$(echo '${{ github.event.inputs.version }}' | sed -E 's/([^.]+)\.([^.]+)\.([^.]+)/v\1.\2.x/')"
- # Sets the release-tag-name output to the version number with the last non-period element replace with a '0' and prepended with v
- echo "::set-output name=release-tag-name::$(echo '${{ github.event.inputs.version }}' | sed -E 's/([^.]+)\.([^.]+)\.([^.]+)/v\1.\2.0/')"
- - id: checkout-release-branch
- name: Check out release branch
- continue-on-error: true
- uses: actions/checkout@v2.3.4
- with:
- ref: ${{ steps.parse-release-branch.outputs.release-branch-name }}
- fetch-depth: 0
- - id: checkout-release-tag
- name: Check out release tag
- if: ${{ steps.checkout-release-branch.outcome == 'failure' }}
- uses: actions/checkout@v2.3.4
- with:
- ref: ${{ steps.parse-release-branch.outputs.release-tag-name }}
- fetch-depth: 0
- - name: Create release branch
- if: ${{ steps.checkout-release-tag.outcome == 'success' }}
- run: |
- git checkout -b ${{ steps.parse-release-branch.outputs.release-branch-name }}
- git push --set-upstream origin ${{ steps.parse-release-branch.outputs.release-branch-name }}
- test:
- runs-on: ubuntu-latest
- needs: prepare-release-branch
- strategy:
- matrix:
- java: [ 8, 11, 15 ]
- steps:
- - uses: actions/checkout@v2.3.4
- with:
- ref: ${{ needs.prepare-release-branch.outputs.release-branch-name }}
- fetch-depth: 0
- - id: setup-test-java
- name: Set up JDK ${{ matrix.java }} for running tests
- uses: actions/setup-java@v2
- with:
- distribution: adopt
- java-version: ${{ matrix.java }}
- - name: Set up JDK 11 for running Gradle
- uses: actions/setup-java@v2
- with:
- distribution: adopt
- java-version: 11
- - name: Restore cache
- uses: burrunan/gradle-cache-action@v1.10
- with:
- job-id: jdk${{ matrix.java }}
- - name: Test
- run: ./gradlew test -PtestJavaVersion=${{ matrix.java }} --stacktrace -x :smoke-tests:test -Porg.gradle.java.installations.paths=${{ steps.setup-test-java.outputs.path }} -Porg.gradle.java.installations.auto-download=false
- testLatestDeps:
- runs-on: ubuntu-latest
- needs: prepare-release-branch
- steps:
- - uses: actions/checkout@v2.3.4
- with:
- ref: ${{ needs.prepare-release-branch.outputs.release-branch-name }}
- fetch-depth: 0
- - name: Set up JDK 11
- uses: actions/setup-java@v2
- with:
- distribution: adopt
- java-version: 11
- - name: Restore cache
- uses: burrunan/gradle-cache-action@v1.10
- with:
- job-id: latestDepTest
- - name: Test
- run: ./gradlew test -x :smoke-tests:test -PtestLatestDeps=true --stacktrace
- smoke-test:
- runs-on: ${{ matrix.os }}
- needs: prepare-release-branch
- strategy:
- matrix:
- os: [ windows-latest, ubuntu-latest ]
- suite: [ "glassfish", "jetty", "liberty", "tomcat", "tomee", "wildfly", "other" ]
- steps:
- - name: Support longpaths
- run: git config --system core.longpaths true
- if: matrix.os == 'windows-latest'
- - uses: actions/checkout@v2.3.4
- with:
- ref: ${{ needs.prepare-release-branch.outputs.release-branch-name }}
- fetch-depth: 0
- - name: Set up JDK 11 for running Gradle
- uses: actions/setup-java@v2
- with:
- distribution: adopt
- java-version: 11
- - name: Restore cache
- uses: burrunan/gradle-cache-action@v1.10
- with:
- job-id: smokeTests
- - name: Test
- run: ./gradlew :smoke-tests:test -PsmokeTestSuite=${{ matrix.suite }}
- example-distro:
- runs-on: ubuntu-latest
- needs: prepare-release-branch
- steps:
- - uses: actions/checkout@v2.3.4
- with:
- ref: ${{ needs.prepare-release-branch.outputs.release-branch-name }}
- fetch-depth: 0
- - name: Set up JDK 11 for running checks
- uses: actions/setup-java@v2
- with:
- distribution: adopt
- java-version: 11
- - name: Restore cache
- uses: burrunan/gradle-cache-action@v1.10
- with:
- job-id: jdk11
- - name: Build
- run: ./gradlew build --stacktrace
- working-directory: examples/distro
- release:
- runs-on: ubuntu-latest
- needs: prepare-release-branch
- steps:
- - uses: actions/checkout@v2.3.4
- with:
- ref: ${{ needs.prepare-release-branch.outputs.release-branch-name }}
- fetch-depth: 0
- - uses: actions/setup-java@v2
- with:
- distribution: adopt
- java-version: 11
- - name: Setup git name
- run: |
- git config user.name github-actions
- git config user.email github-actions@github.com
- - name: Cherrypicks
- if: ${{ github.event.inputs.commits != '' }}
- run: |
- git fetch origin main
- echo ${{ github.event.inputs.commits }} | sed -n 1'p' | tr ',' '\n' | while read word; do
- # Trim whitespaces and cherrypick
- echo $word | sed 's/ *$//g' | sed 's/^ *//g' | git cherry-pick --stdin
- done
- - name: Build and publish artifacts
- uses: burrunan/gradle-cache-action@v1.10
- with:
- job-id: jdk11
- remote-build-cache-proxy-enabled: false
- arguments: build final closeAndReleaseRepository --stacktrace -x :smoke-tests:test -Prelease.version=${{ github.event.inputs.version }}
- env:
- SONATYPE_USER: ${{ secrets.SONATYPE_USER }}
- SONATYPE_KEY: ${{ secrets.SONATYPE_KEY }}
- GRGIT_USER: ${{ github.actor }}
- GRGIT_PASS: ${{ secrets.GITHUB_TOKEN }}
- GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
- GPG_PASSWORD: ${{ secrets.GPG_PASSWORD }}
- - name: Create Release
- id: create_release
- uses: actions/create-release@v1.1.4
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- with:
- tag_name: v${{ github.event.inputs.version }}
- release_name: Release v${{ github.event.inputs.version }}
- draft: true
- prerelease: false
- - name: Upload Release Asset
- id: upload-release-asset
- uses: actions/upload-release-asset@v1.0.2
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- with:
- upload_url: ${{ steps.create_release.outputs.upload_url }}
- asset_path: javaagent/build/libs/opentelemetry-javaagent-${{ github.event.inputs.version }}-all.jar
- asset_name: opentelemetry-javaagent-all.jar
- asset_content_type: application/java-archive
|