diff --git a/.github/workflows/cloudflare.yml b/.github/workflows/cloudflare.yml new file mode 100644 index 000000000..a2f19cc1e --- /dev/null +++ b/.github/workflows/cloudflare.yml @@ -0,0 +1,68 @@ +name: Build and Deploy to Cloudflare +on: + push: + branches: [ 1.x ] + +jobs: + build: + runs-on: ubuntu-latest + name: Build Application + permissions: + contents: read + steps: + - name: Checkout + uses: actions/checkout@v5 + with: + fetch-depth: 0 + + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: 20 + + - name: Install root dependencies + run: npm install --force + + - name: Install antdv-demo dependencies + working-directory: antdv-demo + run: npm install --force + + - name: Build application + working-directory: antdv-demo + run: npm run build + + - name: Upload build artifacts + uses: actions/upload-artifact@v4 + with: + name: build-files + path: antdv-demo/_site/ + retention-days: 1 + + deploy: + runs-on: ubuntu-latest + name: Deploy to Cloudflare + needs: build + permissions: + contents: read + deployments: write + steps: + - name: Checkout (for config files) + uses: actions/checkout@v5 + with: + sparse-checkout: | + wrangler.jsonc + sparse-checkout-cone-mode: false + + - name: Download build artifacts + uses: actions/download-artifact@v4 + with: + name: build-files + path: antdv-demo/_site/ + + - name: Deploy (Workers + Static Assets) + uses: cloudflare/wrangler-action@v3.14.1 + with: + apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} + accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} + command: deploy --config wrangler.jsonc + gitHubToken: ${{ secrets.GITHUB_TOKEN }} diff --git a/antdv-demo/build/webpack.site.conf.js b/antdv-demo/build/webpack.site.conf.js index e9766b3bd..bf7dcf6d7 100644 --- a/antdv-demo/build/webpack.site.conf.js +++ b/antdv-demo/build/webpack.site.conf.js @@ -12,7 +12,7 @@ let lessLoaderConfig = require('./lessLoaderConfig')('production'); module.exports = merge(baseWebpackConfig, { output: { path: path.resolve(__dirname, '../_site'), - publicPath: 'https://aliyuncdn.antdv.com/v1/', + publicPath: '/', filename: '[name].[contenthash:8].js', chunkFilename: '[contenthash:8].async.js', }, diff --git a/antdv-demo/package.json b/antdv-demo/package.json index 75c3b2e5e..25fe0bfe9 100644 --- a/antdv-demo/package.json +++ b/antdv-demo/package.json @@ -3,9 +3,9 @@ "title": "Ant Design Vue", "description": "An enterprise-class UI design language and Vue-based implementation", "scripts": { - "dev": "node --max_old_space_size=4096 build/dev.js", - "start": "cross-env PORT=3001 NODE_ENV=development node --max_old_space_size=4096 node_modules/webpack-dev-server/bin/webpack-dev-server.js --config build/webpack.dev.conf.js", - "site": "node --max_old_space_size=4096 scripts/run.js _site", + "dev": "node --openssl-legacy-provider --max_old_space_size=4096 build/dev.js", + "start": "cross-env PORT=3001 NODE_ENV=development node --openssl-legacy-provider --max_old_space_size=4096 node_modules/webpack-dev-server/bin/webpack-dev-server.js --config build/webpack.dev.conf.js", + "build": "node --openssl-legacy-provider --max_old_space_size=4096 scripts/run.js _site", "copy": "node scripts/run.js copy-html", "prettier": "prettier -c --write '**/*'", "pretty-quick": "pretty-quick" diff --git a/wrangler.jsonc b/wrangler.jsonc new file mode 100644 index 000000000..b5dac70e7 --- /dev/null +++ b/wrangler.jsonc @@ -0,0 +1,14 @@ +{ + "name": "antdv-v1", + "compatibility_date": "2025-09-19", + "assets": { + "directory": "./antdv-demo/_site", + "not_found_handling": "single-page-application" + }, + "routes": [ + { + "pattern": "1x.antdv.com/*", + "zone_name": "antdv.com" + } + ] +}