From e7bf151f4d8cd45220949ac5af724a6ea5e1da8f Mon Sep 17 00:00:00 2001 From: Xi Xu Date: Mon, 17 Nov 2025 19:52:40 +0800 Subject: [PATCH] Add concurrency to workflows and refine sync job Renamed 'depoly.yml' to 'deploy.yml' and added concurrency groups to deploy, image, and sync workflows for better job management. Updated the sync workflow to copy only runtime-required files, removing documentation, tests, and development configs from the deployment process. --- .github/workflows/{depoly.yml => deploy.yml} | 7 ++++++- .github/workflows/image.yml | 4 ++++ .github/workflows/sync.yml | 21 ++++++-------------- 3 files changed, 16 insertions(+), 16 deletions(-) rename .github/workflows/{depoly.yml => deploy.yml} (80%) diff --git a/.github/workflows/depoly.yml b/.github/workflows/deploy.yml similarity index 80% rename from .github/workflows/depoly.yml rename to .github/workflows/deploy.yml index 454f59d..7313876 100644 --- a/.github/workflows/depoly.yml +++ b/.github/workflows/deploy.yml @@ -17,6 +17,10 @@ on: - '.github/PULL_REQUEST_TEMPLATE/**' workflow_dispatch: +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: false + jobs: deploy: runs-on: ubuntu-latest @@ -24,7 +28,8 @@ jobs: permissions: contents: read steps: - - uses: actions/checkout@v5 + - name: Checkout repository + uses: actions/checkout@v5 - name: Deploy Worker uses: cloudflare/wrangler-action@v3 with: diff --git a/.github/workflows/image.yml b/.github/workflows/image.yml index ab7b095..64c0cc1 100644 --- a/.github/workflows/image.yml +++ b/.github/workflows/image.yml @@ -33,6 +33,10 @@ on: - '.github/PULL_REQUEST_TEMPLATE/**' workflow_dispatch: +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + env: REGISTRY: ghcr.io IMAGE_NAME: ${{ github.repository }} diff --git a/.github/workflows/sync.yml b/.github/workflows/sync.yml index 6e86a8d..be202b4 100644 --- a/.github/workflows/sync.yml +++ b/.github/workflows/sync.yml @@ -17,6 +17,10 @@ on: - '.github/PULL_REQUEST_TEMPLATE/**' workflow_dispatch: +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: false + jobs: convert-and-sync: runs-on: ubuntu-latest @@ -43,17 +47,11 @@ jobs: - name: Copy source code files only run: | - # Copy essential source and config files (no documentation, no tests) + # Copy only runtime-required files (no documentation, tests, or dev configs) cp -r src /tmp/page-conversion/ - mkdir -p /tmp/page-conversion/.github/workflows cp package.json /tmp/page-conversion/ cp package-lock.json /tmp/page-conversion/ 2>/dev/null || true cp wrangler.toml /tmp/page-conversion/ - cp vitest.config.js /tmp/page-conversion/ - cp eslint.config.js /tmp/page-conversion/ - cp .prettierrc /tmp/page-conversion/ 2>/dev/null || true - cp .gitignore /tmp/page-conversion/ 2>/dev/null || true - cp tsconfig.json /tmp/page-conversion/ 2>/dev/null || true cp LICENSE /tmp/page-conversion/ - name: Create Pages Function handler @@ -159,12 +157,6 @@ jobs: sed 's/"start": "wrangler dev"/"start": "wrangler pages dev ."/' \ > package.json.tmp && mv package.json.tmp package.json - - name: Update vitest.config.js to include functions/ - run: | - cd /tmp/page-conversion - # Add functions/ to coverage include - sed -i "s/include: \['src\/\*\*\/\*.js', 'src\/\*\*\/\*.ts'\]/include: ['src\/**\/*.js', 'src\/**\/*.ts', 'functions\/**\/*.js']/" vitest.config.js - - name: Initialize page branch run: | cd /tmp/page-conversion @@ -182,9 +174,8 @@ jobs: - Update src/index.js: Export handleRequest for Pages Function import - Update wrangler.toml: Configure for Pages deployment (no observability) - Update package.json: Change scripts to use Pages commands - - Update vitest.config.js: Include functions/ in coverage - Source files only (documentation and tests excluded)." + Runtime files only (documentation, tests, and dev configs excluded)." - name: Force push to page branch run: |