Skip to content

Commit

Permalink
Fix --build-env and --env args construction (#31)
Browse files Browse the repository at this point in the history
* Fix `--build-env` and `--env` args construction

* .

* Bump version

---------

Co-authored-by: Cody Brouwers <[email protected]>
  • Loading branch information
TooTallNate and codybrouwers authored Aug 22, 2024
1 parent 4919c86 commit 7867de5
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
20 changes: 10 additions & 10 deletions vercel-deployment-task-source/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,10 +201,10 @@ async function run() {
if (archive) {
vercelDeployArgs.push("--archive=tgz");
}

if (logs) {
vercelDeployArgs.push("--logs");
}
}

const project = await getProject(vercelProjectId, vercelOrgId, vercelToken)

Expand All @@ -225,8 +225,8 @@ async function run() {
// adding predefined DevOps variables which can be useful during build as env vars in a similiar style as the regular Vercel git integration would (replacing VERCEL with DEVOPS)
if (project.autoExposeSystemEnvs) {
const addEnvVar = (envVar: string) => {
vercelDeployArgs.push(`--build-env ${envVar}`);
vercelDeployArgs.push(`--env ${envVar}`);
vercelDeployArgs.push('--build-env', envVar);
vercelDeployArgs.push('--env', envVar);
}

const commitSha = getVariable("Build.SourceVersion");
Expand All @@ -244,12 +244,12 @@ async function run() {
// adding framework specific vars as with regular integration (currently only Next.js is supported) https://vercel.com/docs/projects/environment-variables/system-environment-variables#framework-environment-variables
switch (project.framework) {
case 'nextjs':
vercelDeployArgs.push(`--build-env NEXT_PUBLIC_DEVOPS_GIT_COMMIT_SHA=${commitSha}`);
vercelDeployArgs.push(`--build-env NEXT_PUBLIC_DEVOPS_GIT_COMMIT_REF=${branchName}`);
vercelDeployArgs.push(`--build-env NEXT_PUBLIC_DEVOPS_GIT_PULL_REQUEST_ID=${pullRequestId}`);
vercelDeployArgs.push(`--build-env NEXT_PUBLIC_DEVOPS_GIT_PROVIDER=devops`);
vercelDeployArgs.push(`--build-env NEXT_PUBLIC_DEVOPS_GIT_REPO_ID=${teamProjectId}`);
vercelDeployArgs.push(`--build-env NEXT_PUBLIC_DEVOPS_GIT_REPO_SLUG=${teamProject}`);
vercelDeployArgs.push('--build-env', `NEXT_PUBLIC_DEVOPS_GIT_COMMIT_SHA=${commitSha}`);
vercelDeployArgs.push('--build-env', `NEXT_PUBLIC_DEVOPS_GIT_COMMIT_REF=${branchName}`);
vercelDeployArgs.push('--build-env', `NEXT_PUBLIC_DEVOPS_GIT_PULL_REQUEST_ID=${pullRequestId}`);
vercelDeployArgs.push('--build-env', `NEXT_PUBLIC_DEVOPS_GIT_PROVIDER=devops`);
vercelDeployArgs.push('--build-env', `NEXT_PUBLIC_DEVOPS_GIT_REPO_ID=${teamProjectId}`);
vercelDeployArgs.push('--build-env', `NEXT_PUBLIC_DEVOPS_GIT_REPO_SLUG=${teamProject}`);
break;
}
}
Expand Down
4 changes: 2 additions & 2 deletions 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": 5,
"Patch": 0
"Patch": 1
},
"instanceNameFormat": "Deploying $(vercelProject) to Vercel",
"inputs": [
Expand Down Expand Up @@ -91,4 +91,4 @@
"target": "dist/index.js"
}
}
}
}
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.5.0",
"version": "1.5.1",
"publisher": "Vercel",
"public": true,
"targets": [
Expand Down

0 comments on commit 7867de5

Please sign in to comment.