You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by ke...@apache.org on 2023/04/25 05:06:44 UTC

[skywalking-python] 01/01: Push Docker images on release

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

kezhenxu94 pushed a commit to branch docker
in repository https://gitbox.apache.org/repos/asf/skywalking-python.git

commit 62a70236ddb1397226c70c2e54b1ae56537957da
Author: kezhenxu94 <ke...@apache.org>
AuthorDate: Tue Apr 25 13:06:33 2023 +0800

    Push Docker images on release
---
 .github/workflows/publish-docker.yaml | 39 ++++++++++++++++++++++++++---------
 1 file changed, 29 insertions(+), 10 deletions(-)

diff --git a/.github/workflows/publish-docker.yaml b/.github/workflows/publish-docker.yaml
index 2b033e1..1342f2c 100644
--- a/.github/workflows/publish-docker.yaml
+++ b/.github/workflows/publish-docker.yaml
@@ -21,10 +21,10 @@ on:
   push:
     branches:
       - master
-
-env:
-  HUB: ghcr.io/apache/skywalking-python
-  PROJECT: skywalking-python
+      - docker
+  release:
+    types:
+      - released
 
 jobs:
   build-docker:
@@ -40,12 +40,31 @@ jobs:
       - uses: actions/checkout@v2
         with:
           submodules: true
+      - 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
+            TAG=${{ github.event.release.tag_name }}
+            echo "TAG=${TAG#v}" >> $GITHUB_ENV
+          else
+            echo "HUB=ghcr.io/apache/skywalking" >> $GITHUB_ENV
+            echo "DOCKER_REGISTRY=ghcr.io/apache/skywalking-python" >> $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 image
-        run: |
-          make push-image -j 5
+        run: make push-image -j 5