diff --git a/README.md b/README.md index c541f51f..e89b5dc9 100644 --- a/README.md +++ b/README.md @@ -82,7 +82,7 @@ Here are all the inputs [deploy-to-vercel-action](https://github.com/BetaHuhn/de | `VERCEL_PROJECT_ID` | Id of your Vercel project (more info [below](#vercel-project)) | **Yes** | N/A | | `GITHUB_DEPLOYMENT` | Create a deployment on GitHub | **No** | true | | `GITHUB_DEPLOYMENT_ENV` | Custom environment for the GitHub deployment. | **No** | `Production` or `Preview` | -| `PRODUCTION` | Create a production deployment on Vercel and GitHub | **No** | true (false for PR deployments) | +| `PRODUCTION` | Create a production deployment on Vercel and GitHub. | **No** | true (false for PR deployments) | | `DELETE_EXISTING_COMMENT` | Delete existing PR comment when redeploying PR | **No** | true | | `CREATE_COMMENT` | Create PR comment when deploying | **No** | true | | `ATTACH_COMMIT_METADATA` | Attach metadata about the commit to the Vercel deployment | **No** | true | @@ -94,8 +94,9 @@ Here are all the inputs [deploy-to-vercel-action](https://github.com/BetaHuhn/de | `VERCEL_SCOPE` | Execute commands from a different Vercel team or user | **No** | N/A | | `BUILD_ENV` | Provide environment variables to the build step | **No** | N/A | | `WORKING_DIRECTORY` | Working directory for the Vercel CLI | **No** | N/A | -| `FORCE` | Used to skip the build cache. | **No** | false -| `PREBUILT` | Deploy a prebuilt Vercel Project. | **No** | false +| `FORCE` | Used to skip the build cache. | **No** | false | +| `PREBUILT` | Deploy a prebuilt Vercel Project. | **No** | false | +| `VERCEL_TARGET` | Specify a custom vercel environment target. Takes priority over `PRODUCTION`. | **No** | `Production` or `Preview` | ## 🛠️ Configuration diff --git a/action.yml b/action.yml index 7f062fd5..831982fc 100644 --- a/action.yml +++ b/action.yml @@ -23,6 +23,10 @@ inputs: description: | Create a production deployment (default: true, false for PR deployments). required: false + VERCEL_TARGET: + description: | + Specify a custom Vercel environment target, such as 'Production' or 'Preview'. Takes priority over PRODUCTION. + required: false PREBUILT: description: | Deploy a prebuilt Vercel Project (default: false). diff --git a/dist/index.js b/dist/index.js index 5f111c02..683d35b8 100644 --- a/dist/index.js +++ b/dist/index.js @@ -15913,6 +15913,9 @@ const context = { type: 'boolean', default: !IS_PR }), + VERCEL_TARGET: parser.getInput({ + key: 'VERCEL_TARGET', + }), GITHUB_DEPLOYMENT: parser.getInput({ key: 'GITHUB_DEPLOYMENT', type: 'boolean', @@ -16242,6 +16245,7 @@ const { VERCEL_SCOPE, VERCEL_ORG_ID, VERCEL_PROJECT_ID, + VERCEL_TARGET, SHA, USER, REPOSITORY, @@ -16267,10 +16271,14 @@ const init = () => { commandArguments.push(`--scope=${ VERCEL_SCOPE }`) } - if (PRODUCTION) { + if (PRODUCTION && !VERCEL_TARGET) { commandArguments.push('--prod') } + if (VERCEL_TARGET) { + commandArguments.push(`--target=${ VERCEL_TARGET }`) + } + if (PREBUILT) { commandArguments.push('--prebuilt') } diff --git a/src/config.js b/src/config.js index 2f2eb22b..fb138c1f 100644 --- a/src/config.js +++ b/src/config.js @@ -27,6 +27,9 @@ const context = { type: 'boolean', default: !IS_PR }), + VERCEL_TARGET: parser.getInput({ + key: 'VERCEL_TARGET', + }), GITHUB_DEPLOYMENT: parser.getInput({ key: 'GITHUB_DEPLOYMENT', type: 'boolean', diff --git a/src/vercel.js b/src/vercel.js index 9370e8d9..b886e838 100644 --- a/src/vercel.js +++ b/src/vercel.js @@ -8,6 +8,7 @@ const { VERCEL_SCOPE, VERCEL_ORG_ID, VERCEL_PROJECT_ID, + VERCEL_TARGET, SHA, USER, REPOSITORY, @@ -33,10 +34,14 @@ const init = () => { commandArguments.push(`--scope=${ VERCEL_SCOPE }`) } - if (PRODUCTION) { + if (PRODUCTION && !VERCEL_TARGET) { commandArguments.push('--prod') } + if (VERCEL_TARGET) { + commandArguments.push(`--target=${ VERCEL_TARGET }`) + } + if (PREBUILT) { commandArguments.push('--prebuilt') }