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-initializer.git


The following commit(s) were added to refs/heads/main by this push:
     new 8115ee6  Update deployment script
     new 829e05b  Merge pull request #15 from AlbumenJ/0417_deploy
8115ee6 is described below

commit 8115ee631a757c75aba80fab00324b95054a7065
Author: Albumen Kevin <[email protected]>
AuthorDate: Mon Apr 17 09:49:23 2023 +0800

    Update deployment script
---
 .github/workflows/build.yml                 |  8 +++-
 .github/workflows/{build.yml => deploy.yml} | 19 ++++++++--
 deployment.yml                              | 57 +++++++++++++++++++++++++++++
 3 files changed, 78 insertions(+), 6 deletions(-)

diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index b43e1cd..e68ae39 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -1,4 +1,4 @@
-name: Build and Deploy
+name: Build
 
 on:
   push:
@@ -12,6 +12,10 @@ jobs:
     runs-on: ubuntu-latest
     steps:
       - uses: actions/checkout@v3
+      - name: Set up QEMU
+        uses: docker/setup-qemu-action@v2
+      - name: Set up Docker Buildx
+        uses: docker/setup-buildx-action@v2
       - name: "Set up JDK 17"
         uses: actions/setup-java@v3
         with:
@@ -31,7 +35,7 @@ jobs:
         if: ${{ github.ref == 'ref/head/main' }}
         with:
           context: .
-          push: true
+          push: false
           file: Dockerfile
           tags: apache/dubbo-initializer:dev
           platforms: linux/amd64
diff --git a/.github/workflows/build.yml b/.github/workflows/deploy.yml
similarity index 66%
copy from .github/workflows/build.yml
copy to .github/workflows/deploy.yml
index b43e1cd..c5e8dc4 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/deploy.yml
@@ -1,8 +1,11 @@
-name: Build and Deploy
+name: Deploy Docker
 
 on:
+  schedule:
+    - cron: '0 0/6 * * *'
   push:
-  pull_request:
+    branches:
+      - 'main'
 
 permissions:
   contents: read
@@ -12,6 +15,10 @@ jobs:
     runs-on: ubuntu-latest
     steps:
       - uses: actions/checkout@v3
+      - name: Set up QEMU
+        uses: docker/setup-qemu-action@v2
+      - name: Set up Docker Buildx
+        uses: docker/setup-buildx-action@v2
       - name: "Set up JDK 17"
         uses: actions/setup-java@v3
         with:
@@ -26,9 +33,13 @@ jobs:
       - name: "Build"
         run: |
           ./mvnw --batch-mode -e --no-transfer-progress --fail-fast package 
-Dmaven.test.skip
-      - name: Build and push
+      - name: Login to DockerHub
+        uses: docker/login-action@v2
+        with:
+          username: ${{ secrets.DOCKERHUB_USER }}
+          password: ${{ secrets.DOCKERHUB_TOKEN }}
+      - name: Build and push docker
         uses: docker/build-push-action@v2
-        if: ${{ github.ref == 'ref/head/main' }}
         with:
           context: .
           push: true
diff --git a/deployment.yml b/deployment.yml
new file mode 100644
index 0000000..4748516
--- /dev/null
+++ b/deployment.yml
@@ -0,0 +1,57 @@
+# 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.
+#
+apiVersion: v1
+kind: Namespace
+metadata:
+  name: dubbo-initializer
+---
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  name: dubbo-initializer
+  namespace: dubbo-initializer
+spec:
+  replicas: 2
+  selector:
+    matchLabels:
+      app: dubbo-initializer
+  template:
+    metadata:
+      labels:
+        app: dubbo-initializer
+    spec:
+      containers:
+        - name: dubbo-initializer
+          image: apache/dubbo-initializer:dev
+          imagePullPolicy: Always
+
+---
+
+apiVersion: v1
+kind: Service
+metadata:
+  name: dubbo-initializer
+  namespace: dubbo-initializer
+spec:
+  type: NodePort
+  sessionAffinity: None
+  selector:
+    app: dubbo-initializer
+  ports:
+    - port: 7001
+      name: http
+      nodePort: 31011
+      targetPort: 7001

Reply via email to