From 90c3c3cee73f377ce1c3ce513667c281b90257c3 Mon Sep 17 00:00:00 2001 From: huangzhiqiang Date: Mon, 9 Jun 2025 11:22:54 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AE=80=E5=8C=96=E5=B7=A5=E4=BD=9C=E6=B5=81?= =?UTF-8?q?=EF=BC=8C=E5=90=88=E5=B9=B6=E7=9B=B8=E5=85=B3=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=EF=BC=8C=E7=A7=BB=E9=99=A4=E4=B8=AD=E9=97=B4=E4=BA=A7=E7=89=A9?= =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=AD=A5=E9=AA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/build-ubuntu.yaml | 59 ++---------------------------- 1 file changed, 3 insertions(+), 56 deletions(-) diff --git a/.gitea/workflows/build-ubuntu.yaml b/.gitea/workflows/build-ubuntu.yaml index 19a3139..15fbba3 100644 --- a/.gitea/workflows/build-ubuntu.yaml +++ b/.gitea/workflows/build-ubuntu.yaml @@ -14,7 +14,7 @@ defaults: shell: 'bash -Eeo pipefail -x {0}' jobs: - build-nginx: + build-and-push: runs-on: ubuntu-22.04 steps: @@ -104,39 +104,11 @@ jobs: echo "停止 NGINX..." sudo /usr/local/nginx/sbin/nginx -s quit - - name: 准备构建产物 + - name: 准备构建上下文 run: | echo "复制 nginx 文件到构建上下文..." sudo cp -r /usr/local/nginx ./nginx-install sudo chown -R $(whoami):$(whoami) ./nginx-install - - # 打包构建产物供后续步骤使用 - tar -czf nginx-install.tar.gz ./nginx-install - - - name: 上传构建产物 - uses: actions/upload-artifact@v3 - with: - name: nginx-install - path: nginx-install.tar.gz - retention-days: 1 - - build-docker-image: - needs: build-nginx - runs-on: ubuntu-22.04 - - steps: - - name: 检出代码 - uses: actions/checkout@v4 - - - name: 下载构建产物 - uses: actions/download-artifact@v3 - with: - name: nginx-install - - - name: 准备构建上下文 - run: | - tar -xzf nginx-install.tar.gz - ls -la - name: 创建 Dockerfile run: | @@ -182,31 +154,6 @@ jobs: echo "构建 Docker 镜像..." docker build -t nginx-local:latest . - - name: 保存 Docker 镜像 - run: | - docker save nginx-local:latest > nginx-image.tar - - - name: 上传 Docker 镜像 - uses: actions/upload-artifact@v3 - with: - name: nginx-docker-image - path: nginx-image.tar - retention-days: 1 - - push-to-harbor: - needs: build-docker-image - runs-on: ubuntu-22.04 - - steps: - - name: 下载 Docker 镜像 - uses: actions/download-artifact@v3 - with: - name: nginx-docker-image - - - name: 加载 Docker 镜像 - run: | - docker load < nginx-image.tar - - name: 登录到 Harbor run: | echo "登录到 Harbor 仓库..." @@ -228,7 +175,7 @@ jobs: docker rmi ${{ secrets.HARBOR_REGISTRY }}/test/nginx:latest || true deploy-to-kubernetes: - needs: push-to-harbor + needs: build-and-push runs-on: ubuntu-22.04 if: github.ref == 'refs/heads/main' && github.event_name == 'push'