Browse Source

Simplify release workflow (#5144)

Trask Stalnaker 3 years ago
parent
commit
71685c1417
3 changed files with 23 additions and 226 deletions
  1. 0 195
      .github/workflows/patch-release-build.yml
  2. 15 17
      .github/workflows/release.yml
  3. 8 14
      RELEASING.md

+ 0 - 195
.github/workflows/patch-release-build.yml

@@ -1,195 +0,0 @@
-# Releases a new patch version from a release branch
-name: Patch Release Build
-on:
-  workflow_dispatch:
-    inputs:
-      release-branch-name:
-        description: The release branch to use, e.g. v1.9.x
-        required: true
-      version:
-        # TODO (trask) this is redundant
-        description: The version of the release, e.g. 1.9.1 (without the "v" prefix)
-        required: true
-
-jobs:
-  test:
-    runs-on: ubuntu-latest
-    strategy:
-      matrix:
-        test-java-version:
-          - 8
-          - 11
-          - 15
-    steps:
-      - uses: actions/checkout@v2.3.4
-        with:
-          ref: ${{ github.event.inputs.release-branch-name }}
-
-      - id: setup-test-java
-        name: Set up JDK ${{ matrix.test-java-version }} for running tests
-        uses: actions/setup-java@v2
-        with:
-          distribution: adopt
-          java-version: ${{ matrix.test-java-version }}
-
-      - name: Set up JDK 11 for running Gradle
-        uses: actions/setup-java@v2
-        with:
-          distribution: adopt
-          java-version: 11
-
-      - name: Test
-        uses: gradle/gradle-build-action@v2
-        with:
-          arguments: test -PtestJavaVersion=${{ matrix.test-java-version }} -Porg.gradle.java.installations.paths=${{ steps.setup-test-java.outputs.path }} -Porg.gradle.java.installations.auto-download=false
-
-  # testLatestDeps is intentionally not included in the release workflows
-  # because any time a new library version is released to maven central
-  # it can fail due to test code incompatibility with the new library version,
-  # or due to slight changes in emitted telemetry
-
-  smoke-test:
-    runs-on: ${{ matrix.os }}
-    strategy:
-      matrix:
-        os:
-          - windows-latest
-          - ubuntu-latest
-        smoke-test-suite:
-          - jetty
-          - liberty
-          - payara
-          - tomcat
-          - tomee
-          - websphere
-          - wildfly
-          - other
-        exclude:
-          - os: windows-latest
-            smoke-test-suite: websphere
-    steps:
-      - name: Support longpaths
-        run: git config --system core.longpaths true
-        if: matrix.os == 'windows-latest'
-
-      - uses: actions/checkout@v2.3.4
-        with:
-          ref: ${{ github.event.inputs.release-branch-name }}
-
-      - name: Set up JDK 11 for running Gradle
-        uses: actions/setup-java@v2
-        with:
-          distribution: adopt
-          java-version: 11
-
-      - name: Test
-        uses: gradle/gradle-build-action@v2
-        with:
-          arguments: ":smoke-tests:test -PsmokeTestSuite=${{ matrix.smoke-test-suite }}"
-
-  # muzzle is intentionally not included in the release workflows
-  # because any time a new library version is released to maven central it can fail,
-  # and this is not a reason to hold up the release
-
-  examples:
-    runs-on: ubuntu-latest
-    steps:
-      - uses: actions/checkout@v2.3.4
-        with:
-          ref: ${{ github.event.inputs.release-branch-name }}
-
-      - name: Set up JDK 11 for running Gradle
-        uses: actions/setup-java@v2
-        with:
-          distribution: adopt
-          java-version: 11
-
-      - name: Local publish of artifacts
-        uses: gradle/gradle-build-action@v2
-        with:
-          # javadoc task fails sporadically fetching https://docs.oracle.com/javase/8/docs/api/
-          arguments: publishToMavenLocal -x javadoc
-
-      - name: Local publish of gradle plugins
-        uses: gradle/gradle-build-action@v2
-        with:
-          # javadoc task fails sporadically fetching https://docs.oracle.com/javase/8/docs/api/
-          arguments: publishToMavenLocal -x javadoc
-          build-root-directory: gradle-plugins
-
-      - name: Build distro
-        uses: gradle/gradle-build-action@v2
-        with:
-          arguments: build --init-script ../../.github/scripts/local.init.gradle.kts
-          build-root-directory: examples/distro
-
-      - name: Build extension
-        uses: gradle/gradle-build-action@v2
-        with:
-          arguments: build --init-script ../../.github/scripts/local.init.gradle.kts
-          build-root-directory: examples/extension
-
-      - name: Run muzzle check against extension
-        uses: gradle/gradle-build-action@v2
-        with:
-          arguments: muzzle --init-script ../../.github/scripts/local.init.gradle.kts
-          build-root-directory: examples/extension
-          cache-read-only: true
-
-  release:
-    needs: [ test, smoke-test, examples ]
-    runs-on: ubuntu-latest
-    steps:
-      - uses: actions/checkout@v2.3.4
-        with:
-          ref: ${{ github.event.inputs.release-branch-name }}
-
-      - name: Set up JDK 11 for running Gradle
-        uses: actions/setup-java@v2
-        with:
-          distribution: adopt
-          java-version: 11
-
-      - name: Build and publish artifacts
-        uses: gradle/gradle-build-action@v2
-        with:
-          arguments: assemble publishToSonatype closeAndReleaseSonatypeStagingRepository
-        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: Build and publish gradle plugins
-        uses: gradle/gradle-build-action@v2
-        env:
-          GRADLE_PUBLISH_KEY: ${{ secrets.GRADLE_PUBLISH_KEY }}
-          GRADLE_PUBLISH_SECRET: ${{ secrets.GRADLE_PUBLISH_SECRET }}
-        with:
-          arguments: build publishPlugins
-          build-root-directory: gradle-plugins
-
-      - 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 }}
-          commitish: ${{ github.event.inputs.release-branch-name }}
-          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 }}.jar
-          asset_name: opentelemetry-javaagent.jar
-          asset_content_type: application/java-archive

+ 15 - 17
.github/workflows/release-build.yml → .github/workflows/release.yml

@@ -1,15 +1,7 @@
-# Releases a new minor / major version from a release branch
+# Releases a new major / minor / patch version from a release branch
 name: Release Build
 on:
   workflow_dispatch:
-    inputs:
-      release-branch-name:
-        description: The release branch to use, e.g. v1.9.x
-        required: true
-      version:
-        # TODO (trask) this is redundant
-        description: The version of the release, e.g. 1.9.0 (without the "v" prefix)
-        required: true
 
 jobs:
   test:
@@ -23,7 +15,7 @@ jobs:
     steps:
       - uses: actions/checkout@v2.3.4
         with:
-          ref: ${{ github.event.inputs.release-branch-name }}
+          ref: ${{ github.ref_name }}
 
       - id: setup-test-java
         name: Set up JDK ${{ matrix.test-java-version }} for running tests
@@ -74,7 +66,7 @@ jobs:
 
       - uses: actions/checkout@v2.3.4
         with:
-          ref: ${{ github.event.inputs.release-branch-name }}
+          ref: ${{ github.ref_name }}
 
       - name: Set up JDK 11 for running Gradle
         uses: actions/setup-java@v2
@@ -96,7 +88,7 @@ jobs:
     steps:
       - uses: actions/checkout@v2.3.4
         with:
-          ref: ${{ github.event.inputs.release-branch-name }}
+          ref: ${{ github.ref_name }}
 
       - name: Set up JDK 11 for running Gradle
         uses: actions/setup-java@v2
@@ -142,7 +134,7 @@ jobs:
     steps:
       - uses: actions/checkout@v2.3.4
         with:
-          ref: ${{ github.event.inputs.release-branch-name }}
+          ref: ${{ github.ref_name }}
 
       - name: Set up JDK 11 for running Gradle
         uses: actions/setup-java@v2
@@ -171,15 +163,21 @@ jobs:
           arguments: build publishPlugins
           build-root-directory: gradle-plugins
 
+      - name: Set release version
+        id: set-release-version
+        run: |
+          v=$(grep -Eo "[0-9]+.[0-9]+.[0-9]+" version.gradle.kts | head -1)
+          echo "::set-output name=release-version::$v"
+
       - 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 }}
-          commitish: ${{ github.event.inputs.release-branch-name }}
-          release_name: Release v${{ github.event.inputs.version }}
+          tag_name: v${{ steps.set-release-version.outputs.release-version }}
+          commitish: ${{ github.ref_name }}
+          release_name: Release v${{ steps.set-release-version.outputs.release-version }}
           draft: true
           prerelease: false
 
@@ -190,6 +188,6 @@ jobs:
           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 }}.jar
+          asset_path: javaagent/build/libs/opentelemetry-javaagent-${{ steps.set-release-version.outputs.release-version }}.jar
           asset_name: opentelemetry-javaagent.jar
           asset_content_type: application/java-archive

+ 8 - 14
RELEASING.md

@@ -26,14 +26,10 @@ Before making the release:
     * examples/extension/build.gradle
   * Bump the version in the download link in the root `README.md` file
 
-Open the release build workflow in your browser [here](https://github.com/open-telemetry/opentelemetry-java-instrumentation/actions/workflows/release-build.yml).
+Open the [Release workflow](https://github.com/open-telemetry/opentelemetry-java-instrumentation/actions/workflows/release.yml).
 
-You will see a button that says "Run workflow". Press the button, then enter the following:
-* Use workflow from: <select the branch from dropdown list, e.g. `v1.9.x`>
-* The release branch to use: <e.g. `v1.9.x`>
-* The version of the release: <e.g. `1.9.0`>
-
-(Yes there is redundancy between the above inputs that we plan to address.)
+Press the "Run workflow" button, then select the release branch from the dropdown list,
+e.g. `v1.9.x`, and click the "Run workflow" button below that.
 
 This triggers the release process, which builds the artifacts, publishes the artifacts, and creates
 and pushes a git tag with the version number.
@@ -73,12 +69,10 @@ Before making the release:
   * examples/distro/build.gradle
   * examples/extension/build.gradle
 
-To make a patch release, open the patch release build workflow in your browser
-[here](https://github.com/open-telemetry/opentelemetry-java-instrumentation/actions/workflows/patch-release-build.yml).
+Open the [Release workflow](https://github.com/open-telemetry/opentelemetry-java-instrumentation/actions/workflows/release.yml).
 
-You will see a button that says "Run workflow". Press the button, then enter the following:
-* Use workflow from: <select the branch from dropdown list, e.g. `v1.9.x`>
-* The release branch to use: <e.g. `v1.9.x`>
-* The version of the release: <e.g. `1.9.1`>
+Press the "Run workflow" button, then select the release branch from the dropdown list,
+e.g. `v1.9.x`, and click the "Run workflow" button below that.
 
-(Yes there is redundancy between the above inputs that we plan to address.)
+This triggers the release process, which builds the artifacts, publishes the artifacts, and creates
+and pushes a git tag with the version number.