You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by li...@apache.org on 2023/11/02 03:23:18 UTC

(dubbo-go-samples) branch main updated: ci: Add a steps to CI for version switch

This is an automated email from the ASF dual-hosted git repository.

liujun pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/dubbo-go-samples.git


The following commit(s) were added to refs/heads/main by this push:
     new baa33ad1 ci: Add a steps to CI for version switch
     new a05ad516 Merge pull request #643 from justxuewei/ci
baa33ad1 is described below

commit baa33ad1e5fd8381a08626eb9cfd4c5d40e01118
Author: Xuewei Niu <ju...@apache.org>
AuthorDate: Thu Nov 2 10:30:18 2023 +0800

    ci: Add a steps to CI for version switch
    
    - CI is triggered only while pushing on "main" and "release-*" branches and
    pull request.
    - Switch the Dubbo-go version on the basis of its branch.
    
    Signed-off-by: Xuewei Niu <ju...@apache.org>
---
 .github/workflows/github-actions.yml | 25 +++++++++++++++++++++----
 1 file changed, 21 insertions(+), 4 deletions(-)

diff --git a/.github/workflows/github-actions.yml b/.github/workflows/github-actions.yml
index b7f1d67b..757d0a38 100644
--- a/.github/workflows/github-actions.yml
+++ b/.github/workflows/github-actions.yml
@@ -2,7 +2,9 @@ name: CI
 
 on:
   push:
-    branches: [master, develop]
+    branches:
+      - main
+      - 'release-*'
   pull_request:
     branches: "*"
 
@@ -12,7 +14,7 @@ jobs:
     name: ${{ matrix.os }} - Go ${{ matrix.go_version }}
     runs-on: ${{ matrix.os }}
     strategy:
-      # If you want to matrix build , you can append the following list.
+      # If you want to matrix build, you can append the following list.
       matrix:
         go_version:
           - 1.17
@@ -24,7 +26,6 @@ jobs:
       DING_SIGN: ${{ secrets.DING_SIGN }}
 
     steps:
-
       - name: Set up Go 1.x
         uses: actions/setup-go@v2
         with:
@@ -63,10 +64,26 @@ jobs:
         uses: golangci/golangci-lint-action@v3
         with:
           args: --timeout 10m --verbose
-
+      
       - name: License
         run: make -f build/Makefile license
 
+      - name: Switch Dubbo-go version
+        run: |
+          # Acquire information of branch
+          if [ "$GITHUB_EVENT_NAME" == "pull_request" ]; then
+            BRANCH=${{github.base_ref}}
+          elif [ "$GITHUB_EVENT_NAME" == "push" ]; then
+            BRANCH=$GITHUB_REF_NAME
+          else
+            echo "$GITHUB_EVENT_NAME event is unsupported right now"
+            exit 1
+          fi
+          echo "EVENT = $GITHUB_EVENT_NAME, BRANCH = $BRANCH"
+          # Edit the version
+          go mod edit -replace=dubbo.apache.org/dubbo-go/v3=dubbo.apache.org/dubbo-go/v3@$BRANCH
+          go mod tidy
+
       - name: Integration Test
         run: |
           ./start_integrate_test.sh
\ No newline at end of file