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

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


The following commit(s) were added to refs/heads/release-3.0 by this push:
     new 8820ce07 ci: Add a steps to CI for version switch
     new 0b8d7539 Merge pull request #644 from justxuewei/ci-30
8820ce07 is described below

commit 8820ce07d2b231219fa71a1651c450aee64fccf6
Author: Xuewei Niu <justxue...@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 <justxue...@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 22478620..1538cd06 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

Reply via email to