diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml new file mode 100644 index 0000000..8b62b6b --- /dev/null +++ b/.github/workflows/maven.yml @@ -0,0 +1,37 @@ +# 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' + 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 }} +