You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shenyu.apache.org by xi...@apache.org on 2022/06/08 04:27:20 UTC

[incubator-shenyu] branch master updated: [type:feature] add github flow to publish docker image to ghcr.io (#3496)

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

xiaoyu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-shenyu.git


The following commit(s) were added to refs/heads/master by this push:
     new 96ccc6fc2 [type:feature] add github flow to publish docker image to ghcr.io (#3496)
96ccc6fc2 is described below

commit 96ccc6fc269fa70c726027ed6feb2e5fe8514e17
Author: Luke.Z <10...@users.noreply.github.com>
AuthorDate: Wed Jun 8 12:27:15 2022 +0800

    [type:feature] add github flow to publish docker image to ghcr.io (#3496)
    
    * add github flow to publish docker image to ghcr.io
    
    * fix
---
 .github/workflows/docker-publish.yml | 97 ++++++++++++++++++++++++++++++++++++
 1 file changed, 97 insertions(+)

diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml
new file mode 100644
index 000000000..ebc7a3048
--- /dev/null
+++ b/.github/workflows/docker-publish.yml
@@ -0,0 +1,97 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+name: docker-publish
+
+on:
+  push:
+    branches: [ "master" ]
+    tags: [ 'v*.*.*' ]
+
+env:
+  REGISTRY: ghcr.io
+  REPOSITORY: ${{ github.repository }}
+  TAG: ${{ github.sha }}
+
+jobs:
+  build:
+    runs-on: ubuntu-latest
+    permissions:
+      contents: read
+      packages: write
+      id-token: write
+
+    steps:
+      - uses: actions/checkout@v3
+        with:
+          submodules: true
+
+      - name: Set Skip Env Var
+        uses: ./.github/actions/skip-ci
+
+      - name: Login to GitHub Container Registry
+        uses: docker/login-action@v2
+        if: env.SKIP_CI != 'true'
+        with:
+          registry: ${{ env.REGISTRY }}
+          username: ${{ github.actor }}
+          password: ${{ secrets.GITHUB_TOKEN }}
+
+      - name: Set up QEMU
+        uses: docker/setup-qemu-action@v2
+        if: env.SKIP_CI != 'true'
+
+      - name: Set up Docker Buildx
+        uses: docker/setup-buildx-action@v2
+        if: env.SKIP_CI != 'true'
+
+      - name: Available platforms
+        run: echo ${{ steps.buildx.outputs.platforms }}
+        if: env.SKIP_CI != 'true'
+
+      - name: Cache Maven Repos
+        if: env.SKIP_CI != 'true'
+        uses: actions/cache@v2
+        with:
+          path: ~/.m2/repository
+          key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
+          restore-keys: |
+            ${{ runner.os }}-maven-
+
+      - uses: actions/setup-java@v1
+        if: env.SKIP_CI != 'true'
+        with:
+          java-version: ${{ matrix.java }}
+      - name: Build with Maven
+        if: env.SKIP_CI != 'true'
+        run: ./mvnw -B clean package -Prelease
+
+      - name: Build and push(admin)
+        uses: docker/build-push-action@v3
+        if: env.SKIP_CI != 'true'
+        with:
+          context: ./shenyu-dist/shenyu-admin-dist
+          platforms: linux/amd64,linux/arm64
+          push: true
+          tags: ${{ env.REGISTRY }}/${{ env.REPOSITORY }}/admin:${{ env.TAG }}
+
+      - name: Build and push(bootstrap)
+        uses: docker/build-push-action@v3
+        if: env.SKIP_CI != 'true'
+        with:
+          context: ./shenyu-dist/shenyu-bootstrap-dist
+          platforms: linux/amd64,linux/arm64
+          push: true
+          tags: ${{ env.REGISTRY }}/${{ env.REPOSITORY }}/bootstrap:${{ env.TAG }}