diff --git a/.github/workflows/example.yml b/.github/workflows/example.yml index ade64d3..c55a3ea 100644 --- a/.github/workflows/example.yml +++ b/.github/workflows/example.yml @@ -14,7 +14,7 @@ jobs: uses: ./ with: apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} - accountId: 468cce80dfb431f3a4058e6dc6031a44 + accountId: ${{ vars.CLOUDFLARE_ACCOUNT_ID }} projectName: github-actions-example directory: example gitHubToken: ${{ secrets.GITHUB_TOKEN }} diff --git a/action.yml b/action.yml index 61e3f56..19b053d 100644 --- a/action.yml +++ b/action.yml @@ -13,9 +13,6 @@ inputs: projectName: description: "The name of the Pages project to upload to" required: true - directory: - description: "The directory of static assets to upload" - required: true gitHubToken: description: "GitHub Token" required: false @@ -28,7 +25,7 @@ inputs: wranglerVersion: description: "The version of Wrangler to use" required: false - default: "2" + default: "3.57.2" runs: using: "node16" main: "index.js" diff --git a/index.js b/index.js index 7df67c8..7daf13d 100644 --- a/index.js +++ b/index.js @@ -22065,7 +22065,6 @@ try { const apiToken = (0, import_core.getInput)("apiToken", { required: true }); const accountId = (0, import_core.getInput)("accountId", { required: true }); const projectName = (0, import_core.getInput)("projectName", { required: true }); - const directory = (0, import_core.getInput)("directory", { required: true }); const gitHubToken = (0, import_core.getInput)("gitHubToken", { required: false }); const branch = (0, import_core.getInput)("branch", { required: false }); const workingDirectory = (0, import_core.getInput)("workingDirectory", { required: false }); @@ -22094,7 +22093,7 @@ try { $ export CLOUDFLARE_ACCOUNT_ID="${accountId}" } - $$ npx wrangler@${wranglerVersion} pages publish "${directory}" --project-name="${projectName}" --branch="${branch}" + $$ npx wrangler@${wranglerVersion} pages deploy `; const response = await (0, import_undici.fetch)( `https://api.cloudflare.com/client/v4/accounts/${accountId}/pages/projects/${projectName}/deployments`, @@ -22152,7 +22151,7 @@ try { } await import_core.summary.addRaw( ` -# Deploying with Cloudflare Pages +# ${projectName} Deploying with Cloudflare Pages | Name | Result | | ----------------------- | - | diff --git a/package.json b/package.json index 6c86547..f10c184 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pages-action", - "version": "1.5.0", + "version": "2.0.0", "description": "Publish to Cloudflare Pages", "main": "index.js", "scripts": { diff --git a/src/index.ts b/src/index.ts index a63f38e..3ace872 100644 --- a/src/index.ts +++ b/src/index.ts @@ -12,7 +12,6 @@ try { const apiToken = getInput("apiToken", { required: true }); const accountId = getInput("accountId", { required: true }); const projectName = getInput("projectName", { required: true }); - const directory = getInput("directory", { required: true }); const gitHubToken = getInput("gitHubToken", { required: false }); const branch = getInput("branch", { required: false }); const workingDirectory = getInput("workingDirectory", { required: false }); @@ -46,7 +45,7 @@ try { $ export CLOUDFLARE_ACCOUNT_ID="${accountId}" } - $$ npx wrangler@${wranglerVersion} pages publish "${directory}" --project-name="${projectName}" --branch="${branch}" + $$ npx wrangler@${wranglerVersion} pages deploy `; const response = await fetch( @@ -122,7 +121,7 @@ try { await summary .addRaw( ` -# Deploying with Cloudflare Pages +# ${projectName} Deploying with Cloudflare Pages | Name | Result | | ----------------------- | - | diff --git a/wrangler.toml b/wrangler.toml new file mode 100644 index 0000000..c3965ee --- /dev/null +++ b/wrangler.toml @@ -0,0 +1,7 @@ +# Generated by Wrangler on Wed May 29 2024 11:47:23 GMT+0800 (中国标准时间) +name = "github-actions-example" +pages_build_output_dir = "example" +compatibility_date = "2024-05-29" + +[env.production] +compatibility_date = "2024-05-29"