From 8c70ed6c70fdd61693f8485335e64814212bb787 Mon Sep 17 00:00:00 2001 From: lilingfengdev <145678359+lilingfengdev@users.noreply.github.com> Date: Sun, 23 Jun 2024 17:46:54 +0800 Subject: [PATCH] Update docker.yml --- .github/workflows/docker.yml | 62 ++++++++++++++++++++++++++++-------- 1 file changed, 48 insertions(+), 14 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 316e765..2fe4591 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -1,23 +1,57 @@ -name: docker +name: GitHub Actions Build and Deploy + +# 触发条件 on: - push: - branches: - - main + [push] + + +# 设置权限 +permissions: + contents: write +# 设置上海时区 +env: + TZ: Asia/Shanghai + +# 任务 jobs: - docker: + build-and-deploy: + # 服务器环境:最新版 ubuntu runs-on: ubuntu-latest + strategy: + matrix: + node-version: [20] steps: - - uses: actions/checkout@v4 + # 拉取代码 + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 - - name: Login to Docker Hub - uses: docker/login-action@v3 + # 安装 pnpm + - name: Install pnpm + uses: pnpm/action-setup@v3 with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} + version: 8 + + # 设置 node 版本 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + cache: 'pnpm' + + # 打包静态文件 + - name: Build + env: + APP_BASE_PATH: /${{ github.repository }} + run: pnpm install && pnpm run build - - name: Build and push Docker image - uses: docker/build-push-action@v5 + # 部署 + - name: Deploy + uses: JamesIves/github-pages-deploy-action@v4 with: - push: true - tags: jazee6/cloudflare-ai-web:latest \ No newline at end of file + # GitHub Pages 读取的分支 + branch: gh-pages + # 静态文件所在目录 + folder: dist