From 2438a1e5a745c1ff076d99c084bc048528ef5518 Mon Sep 17 00:00:00 2001 From: Lars Francke Date: Wed, 18 Sep 2024 15:05:01 +0200 Subject: [PATCH] Attempt at improving the build & release pipelines (#108) * Attempt at improving the build & release pipelines to use preferred Java versions per Druid version * yamllint * Update the workflow to hardcode the java version * shellcheck --- .github/workflows/maven.yml | 14 ++++++++------ .github/workflows/release.yml | 27 ++++++++++++++++++++++----- 2 files changed, 30 insertions(+), 11 deletions(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 94e2ddd..aa5e7b2 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -20,19 +20,21 @@ jobs: strategy: matrix: profile: - - druid-26.0.0 - - druid-30.0.0 - + - {druid: druid-26.0.0, java: '11'} + - {druid: druid-30.0.0, java: '17'} steps: - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - - name: Set up JDK 17 + + - name: Set up JDK uses: actions/setup-java@2dfa2011c5b2a0f1489bf9e433881c92c1631f88 # v4.3.0 with: - java-version: '17' + java-version: ${{ matrix.profile.java }} distribution: 'temurin' cache: maven + - name: Build with Maven - run: mvn -B verify -P${{ matrix.profile }} + run: mvn -B verify -P${{ matrix.profile.druid }} + - name: Update dependency graph if: github.event_name == 'push' && github.ref == 'refs/heads/main' uses: advanced-security/maven-dependency-submission-action@4f64ddab9d742a4806eeb588d238e4c311a8397d # v4.1.1 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9294b5f..94de2d3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -5,10 +5,14 @@ on: workflow_dispatch: inputs: druid-version: - description: 'Druid version to build the authorizer for. This requires an existing profile with the same name.' + description: 'Select the Druid version to build the authorizer for.' required: true + type: choice + options: + - druid-26.0.0 + - druid-30.0.0 stackable-version: - description: 'The stackable "patch" version to use for this release (starting at 0 and counting up, e.g. "0")' + description: 'The stackable "patch" version to use for this release (e.g., "0").' required: true next-stackable-version: description: 'The next stackable version to use, this updates the POM (without the "-SNAPSHOT"). If stackable-version is 0 then set this to 1 etc.' @@ -19,21 +23,34 @@ jobs: runs-on: ubuntu-latest steps: + - name: Set Java Version + id: set_java_version + run: | + if [ "${{ github.event.inputs.druid-version }}" = "druid-26.0.0" ]; then + echo "JAVA_VERSION=11" >> "$GITHUB_ENV" + elif [ "${{ github.event.inputs.druid-version }}" = "druid-30.0.0" ]; then + echo "JAVA_VERSION=17" >> "$GITHUB_ENV" + else + echo "JAVA_VERSION=unknown" >> "$GITHUB_ENV" + fi + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + - name: Release uses: qcastel/github-actions-maven-release@681756a2798ce7fc477d2db2fefcdec6670f6fed # tag=v1.12.41 env: # This action uses a Dockerfile with Java preinstalled # See here for the list of supported JDKs: https://github.com/qcastel/docker-maven-release/blob/master/Dockerfile - JAVA_HOME: /usr/lib/jvm/java-17-openjdk/ + JAVA_HOME: /usr/lib/jvm/java-${{ env.JAVA_VERSION }}-openjdk/ with: git-release-bot-name: "stacky-mcstackface" git-release-bot-email: "info@stackable.tech" - maven-args: "clean install -P druid-${{ github.event.inputs.druid-version }}" + maven-args: "clean install -P ${{ github.event.inputs.druid-version }}" ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} maven-release-version-number: ${{ github.event.inputs.druid-version }}-stackable${{ github.event.inputs.stackable-version }} - maven-development-version-number: ${{ github.event.inputs.druid-version }}-stackable${{ github.event.inputs.next-stackable-version}}-SNAPSHOT + maven-development-version-number: ${{ github.event.inputs.druid-version }}-stackable${{ github.event.inputs.next-stackable-version }}-SNAPSHOT release-branch-name: "main" + - name: Release to GitHub uses: softprops/action-gh-release@c062e08bd532815e2082a85e87e3ef29c3e6d191 # v2.0.8 with: