Skip to content

Commit f44da55

Browse files
committed
feat: add support for --env. fixes #398
1 parent 9893d87 commit f44da55

4 files changed

Lines changed: 16 additions & 0 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ Here are all the inputs [deploy-to-vercel-action](https://github.com/BetaHuhn/de
9393
| `PR_PREVIEW_DOMAIN` | Custom preview domain for PRs (more info [below](#custom-domains)) | **No** | N/A |
9494
| `VERCEL_SCOPE` | Execute commands from a different Vercel team or user | **No** | N/A |
9595
| `BUILD_ENV` | Provide environment variables to the build step | **No** | N/A |
96+
| `ENV` | Provide environment variables that will be available at runtime | **No** | N/A |
9697
| `WORKING_DIRECTORY` | Working directory for the Vercel CLI | **No** | N/A |
9798
| `FORCE` | Used to skip the build cache. | **No** | false
9899
| `PREBUILT` | Deploy a prebuilt Vercel Project. | **No** | false

action.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,10 @@ inputs:
7575
description: |
7676
Provide environment variables to the build step.
7777
required: false
78+
ENV:
79+
description: |
80+
Provide environment variables that will be available at runtime.
81+
required: false
7882
WORKING_DIRECTORY:
7983
description: |
8084
Working directory for the Vercel CLI.

src/config.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,10 @@ const context = {
8888
key: 'BUILD_ENV',
8989
type: 'array'
9090
}),
91+
ENV: parser.getInput({
92+
key: 'ENV',
93+
type: 'array'
94+
}),
9195
PREBUILT: parser.getInput({
9296
key: 'PREBUILT',
9397
type: 'boolean',

src/vercel.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ const {
1414
REF,
1515
TRIM_COMMIT_MESSAGE,
1616
BUILD_ENV,
17+
ENV,
1718
PREBUILT,
1819
WORKING_DIRECTORY,
1920
FORCE
@@ -70,6 +71,12 @@ const init = () => {
7071
})
7172
}
7273

74+
if (ENV) {
75+
ENV.forEach((item) => {
76+
commandArguments = commandArguments.concat([ '--env', item ])
77+
})
78+
}
79+
7380
core.info('Starting deploy with Vercel CLI')
7481
const output = await exec('vercel', commandArguments, WORKING_DIRECTORY)
7582
const parsed = output.match(/(?<=https?:\/\/)(.*)/g)[0]

0 commit comments

Comments
 (0)