From b13a143f527348edda3e6437c0f32065b09d5fec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=8A=E5=AE=98=E6=98=93=E6=B3=BD?= <15837994614@163.com> Date: Sat, 7 Aug 2021 00:12:08 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AC=AC=E5=85=AD=E6=AC=A1=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/maven.yml | 36 ++++++++++++++++++++++++++++++++++++ .github/workflows/maven1.yml | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+) create mode 100644 .github/workflows/maven.yml create mode 100644 .github/workflows/maven1.yml diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml new file mode 100644 index 0000000..3c151f6 --- /dev/null +++ b/.github/workflows/maven.yml @@ -0,0 +1,36 @@ +# This workflow will build a Java project with Maven +# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven + +name: Java CI with Maven + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@master + - name: Set up JDK 8 + uses: actions/setup-java@v2 + with: + java-version: '8' + - name: Build with Maven + run: mvn -B package --file pom.xml + # 通过 Dockerfile 构建镜像 + - name: Build docker image + run: docker build . -t {{ image_name:image_version }} + + # 登陆到我们自己的 docker registry + - name: Login to aliyun docker image registry + run: echo "${{ secrets.REGISTRY_PASSWORD }}" | docker login --username=shangguanyize registry.cn-hangzhou.aliyuncs.com --password-stdin + + # 上传 docker 镜像 + - name: Push image to aliyun docker image registry + run: docker push {{ image_name:image_version }} + diff --git a/.github/workflows/maven1.yml b/.github/workflows/maven1.yml new file mode 100644 index 0000000..9f225d0 --- /dev/null +++ b/.github/workflows/maven1.yml @@ -0,0 +1,33 @@ +name: Java CI with Maven + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@master + - name: Set up JDK 8 + uses: actions/setup-java@v2 + with: + java-version: '1.8' + distribution: 'adopt' + - name: Build with Maven + run: mvn -B package --file pom.xml + # 通过 Dockerfile 构建镜像 + - name: Build docker image + run: docker build . -t {{ image_name:image_version }} + + # 登陆到我们自己的 docker registry + - name: Login to aliyun docker image registry + run: echo "${{ secrets.REGISTRY_PASSWORD }}" | docker login --username=shangguanyize registry.cn-hangzhou.aliyuncs.com --password-stdin + + # 上传 docker 镜像 + - name: Push image to aliyun docker image registry + run: docker push {{ image_name:image_version }}