From e6d541afc0fbf69a49121e78b909d2c3d579084b Mon Sep 17 00:00:00 2001 From: aastha25 Date: Mon, 12 Feb 2024 17:37:34 -0800 Subject: [PATCH] modify workflow action --- .github/workflows/ci.yml | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2ce0a3629..1d6a69b91 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,7 +9,7 @@ name: CI on: push: - branches: ['master'] + branches: ['master', 'li-trino-hotfix'] tags-ignore: [v*] # release tags are autogenerated after a successful CI, no need to run CI against them pull_request: branches: ['**'] @@ -35,7 +35,7 @@ jobs: - name: 3. Perform build run: ./gradlew -i build - - name: 4. Perform release + - name: 4. Perform release for master branch if commit is on master # Release job, only for pushes to the main development branch if: github.event_name == 'push' && github.ref == 'refs/heads/master' @@ -49,3 +49,26 @@ jobs: SONATYPE_PWD: ${{secrets.SONATYPE_PWD}} PGP_KEY: ${{secrets.PGP_KEY}} PGP_PWD: ${{secrets.PGP_PWD}} + + - name: 5. Derive version for li-trino-hotfix + if: github.ref == 'refs/heads/li-trino-hotfix' + run: | + branch_name="${{ github.ref#refs/heads/ }}" + echo "branch_name=${branch_name}" >> $GITHUB_ENV + echo "DERIVED_VERSION=2.2.27-${branch_name}" >> $GITHUB_ENV + + - name: 6. Perform release for li-trino-hotfix branch if commit is this branch + # Release job, only for pushes to the main development branch + if: github.event_name == 'push' + && github.ref == 'refs/heads/li-trino-hotfix' + && github.repository == 'linkedin/coral' + && !contains(toJSON(github.event.commits.*.message), '[skip release]') + + run: ./gradlew githubRelease publishToSonatype closeAndReleaseStagingRepository --stacktrace -Pversion="${{ env.DERIVED_VERSION }}" + env: + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} + SONATYPE_USER: ${{secrets.SONATYPE_USER}} + SONATYPE_PWD: ${{secrets.SONATYPE_PWD}} + PGP_KEY: ${{secrets.PGP_KEY}} + PGP_PWD: ${{secrets.PGP_PWD}} +