You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by wu...@apache.org on 2023/03/08 13:51:18 UTC

[skywalking] branch master updated: Publish Docker images on official release (#10508)

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

wusheng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/skywalking.git


The following commit(s) were added to refs/heads/master by this push:
     new 91991ab87e Publish Docker images on official release (#10508)
91991ab87e is described below

commit 91991ab87e16588a60bab8e195563e4b6c3ce598
Author: kezhenxu94 <ke...@apache.org>
AuthorDate: Wed Mar 8 21:50:59 2023 +0800

    Publish Docker images on official release (#10508)
---
 .github/workflows/publish-docker.yaml | 37 +++++++++++++++++++++++++----------
 docs/en/guides/How-to-release.md      |  4 ++++
 2 files changed, 31 insertions(+), 10 deletions(-)

diff --git a/.github/workflows/publish-docker.yaml b/.github/workflows/publish-docker.yaml
index e4feca9b31..92aeaef0e4 100644
--- a/.github/workflows/publish-docker.yaml
+++ b/.github/workflows/publish-docker.yaml
@@ -20,10 +20,12 @@ on:
   push:
     branches:
       - master
+  release:
+    types:
+      - released
 
 env:
   SKIP_TEST: true
-  HUB: ghcr.io/apache/skywalking
 
 jobs:
   build:
@@ -33,8 +35,6 @@ jobs:
       contents: read
       packages: write
     timeout-minutes: 90
-    env:
-      TAG: ${{ github.sha }}
     steps:
       - uses: actions/checkout@v3
         with:
@@ -46,20 +46,37 @@ jobs:
           key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
           restore-keys: |
             ${{ runner.os }}-maven-
+      - name: Set environment variables
+        run: |
+          if [[ ${{ github.event_name }} == "release" ]]; then
+            echo "HUB=apache" >> $GITHUB_ENV
+            echo "DOCKER_REGISTRY=docker.io" >> $GITHUB_ENV
+            echo "DOCKER_USERNAME=${{ secrets.DOCKERHUB_USER }}" >> $GITHUB_ENV
+            echo "DOCKER_PASSWORD=${{ secrets.DOCKERHUB_TOKEN }}" >> $GITHUB_ENV
+            echo "OAP_NAME=skywalking-oap-server" >> $GITHUB_ENV
+            echo "UI_NAME=skywalking-ui" >> $GITHUB_ENV
+            echo "TAG=${{ github.event.release.tag_name }}" >> $GITHUB_ENV
+          else
+            echo "HUB=ghcr.io/apache/skywalking" >> $GITHUB_ENV
+            echo "DOCKER_REGISTRY=ghcr.io/apache/skywalking" >> $GITHUB_ENV
+            echo "DOCKER_USERNAME=${{ github.actor }}" >> $GITHUB_ENV
+            echo "DOCKER_PASSWORD=${{ secrets.GITHUB_TOKEN }}" >> $GITHUB_ENV
+            echo "TAG=${{ github.sha }}" >> $GITHUB_ENV
+          fi
       - name: Log in to the Container registry
-        uses: docker/login-action@v1.10.0
+        uses: docker/login-action@v2
         with:
-          registry: ${{ env.HUB }}
-          username: ${{ github.actor }}
-          password: ${{ secrets.GITHUB_TOKEN }}
+          registry: ${{ env.DOCKER_REGISTRY }}
+          username: ${{ env.DOCKER_USERNAME }}
+          password: ${{ env.DOCKER_PASSWORD }}
       - name: Set up QEMU
         uses: docker/setup-qemu-action@v1
       - name: Set up Docker Buildx
         uses: docker/setup-buildx-action@v1
+      - name: Build and push docker images
+        run: make build.all docker.push
       - name: Build and push docker images based on Java 17
         env:
           SW_OAP_BASE_IMAGE: eclipse-temurin:17-jre
-          TAG: ${{ github.sha }}-java17
+          TAG: ${{ env.TAG }}-java17
         run: make build.all docker.push
-      - name: Build and push docker images
-        run: make build.all docker.push push.docker.data-generator
diff --git a/docs/en/guides/How-to-release.md b/docs/en/guides/How-to-release.md
index cb4727f0fa..7c3667c757 100644
--- a/docs/en/guides/How-to-release.md
+++ b/docs/en/guides/How-to-release.md
@@ -282,6 +282,10 @@ SkyWalking Resources:
 
 ## Publish the Docker images
 
+We have a [GitHub workflow](../../../.github/workflows/publish-docker.yaml) to automatically publish the Docker images to
+Docker Hub after you set the version from `pre-release` to `release`, all you need to do is to watch that workflow and see
+whether it succeeds, if it fails, you can use the following steps to publish the Docker images in your local machine.
+
 ```shell
 export SW_VERSION=x.y.z
 git clone --depth 1 --branch v$SW_VERSION https://github.com/apache/skywalking.git