From 08c16cc5755ec6df32aee1efaa7a81ebd61ef965 Mon Sep 17 00:00:00 2001 From: xuthus Date: Mon, 15 Apr 2024 21:25:42 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/build.yaml | 49 +++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 .gitea/workflows/build.yaml diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml new file mode 100644 index 0000000..c0aedae --- /dev/null +++ b/.gitea/workflows/build.yaml @@ -0,0 +1,49 @@ +name: pigallery2 +run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀 +on: [push] + +# 工作流程,可包含多个作业 +jobs: + + # 作业1名称 + pigallery2-Gitea-Actions: + # 指定的运行器环境 + runs-on: ubuntu-latest + + # 作业包含一系列任务,称为 steps + steps: + - uses: actions/checkout@v2 + - name: Set up JDK 21 + uses: actions/setup-java@v2 + with: + java-version: '1.8' + distribution: 'adopt' + # maven缓存,不加的话每次都会去重新拉取,会影响速度 + - name: Dependies Cache + uses: actions/cache@v2 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-maven- + # 编译打包 + - name: Build with Maven + run: | + mvn package -Dmaven.test.skip=true + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v1 + #build镜像并push到中央仓库中 + - name: Build and push + id: docker_build + uses: docker/build-push-action@v2 + with: + context: ./ + file: ./Dockerfile.build + push: true + tags: k2.xuthus83.cn:6001/pigallery2:latest +# - name: Build the Docker image +# run: +# | # 使用 上一步写的 Dockerfile 构建镜像并发布到私有仓库; 发布完成可以去 https://github.com/MrGaoGang?tab=packages 查看 +# docker build . --file Dockerfile.build --tag k2.xuthus83.cn:6001/pigallery2:latest . +# docker push k2.xuthus83.cn:6001/pigallery2:latest \ No newline at end of file