Skip to content

Commit

Permalink
feat: add env inputs (#35)
Browse files Browse the repository at this point in the history
* feat: add env inputs

* Bump version

---------

Co-authored-by: Cody Brouwers <11965195+codybrouwers@users.noreply.github.com>
  • Loading branch information
phidol and codybrouwers authored Sep 17, 2024
1 parent 4c1dc10 commit 4f49587
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 2 deletions.
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,22 @@ The configuration inputs `vercelProjectID`, `vercelOrgID`, and `vercelToken` can

Required: `false`

- `env`

Adding enviroment variables at runtime utilizing Vercel CLI's `--env` option.

Type: `string`

Required: `false`

- `buildEnv`

Adding build enviroment variables to the build step utilizing Vercel CLI's `--build-env` option.

Type: `string`

Required: `false`

- `logs`

Enable `--logs` flag for the internal Vercel CLI operations.
Expand Down
12 changes: 12 additions & 0 deletions vercel-deployment-task-source/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {
getInput,
getDelimitedInput,
getBoolInput,
TaskResult,
setResult,
Expand Down Expand Up @@ -131,6 +132,9 @@ async function run() {

const archive = getBoolInput("archive");

const envs = getDelimitedInput("env", "\n", false);
const buildEnvs = getDelimitedInput("buildEnv", "\n", false);

const logs = getBoolInput("logs");

const vercelProjectId = reconcileConfigurationInput(
Expand Down Expand Up @@ -200,6 +204,14 @@ async function run() {
if (archive) {
vercelDeployArgs.push("--archive=tgz");
}

envs.forEach((env) => {
vercelDeployArgs.push("--env", env);
});
buildEnvs.forEach((buildEnv) => {
vercelDeployArgs.push("--build-env", buildEnv);
});

const vercelDeploy = vercel.arg(vercelDeployArgs);
({ stdout, stderr, code } = vercelDeploy.execSync());

Expand Down
24 changes: 23 additions & 1 deletion vercel-deployment-task-source/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"version": {
"Major": 1,
"Minor": 6,
"Patch": 1
"Patch": 2
},
"instanceNameFormat": "Deploying $(vercelProject) to Vercel",
"inputs": [
Expand Down Expand Up @@ -64,6 +64,28 @@
"required": false,
"helpMarkDown": "Enable `--archive=tgz` flag for the internal Vercel CLI operations."
},
{
"name": "env",
"type": "multiLine",
"properties": {
"resizable": true,
"rows": "2"
},
"label": "Env vars",
"required": false,
"helpMarkDown": "Additional environment variables to be provided at runtime. One line per env (e.g. KEY1=value1)."
},
{
"name": "buildEnv",
"type": "multiLine",
"properties": {
"resizable": true,
"rows": "2"
},
"label": "Build env vars",
"required": false,
"helpMarkDown": "Additional environment variables to be provided during build. One line per env (e.g. KEY1=value1)."
},
{
"name": "logs",
"type": "boolean",
Expand Down
2 changes: 1 addition & 1 deletion vss-extension.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"manifestVersion": 1,
"id": "vercel-deployment-extension",
"name": "Vercel Deployment Extension",
"version": "1.6.1",
"version": "1.6.2",
"publisher": "Vercel",
"public": true,
"targets": [
Expand Down

0 comments on commit 4f49587

Please sign in to comment.