Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support SWA Access Token #20501

Merged
merged 13 commits into from
Oct 3, 2024
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,9 @@
"loc.input.label.production_branch": "Production Branch",
"loc.input.help.production_branch": "Production branch. When specified and Deployment Environment is empty, deployments from other branches will be preview environments",
"loc.input.label.data_api_location": "Data api location",
"loc.input.help.data_api_location": "Directory location of the Data API source files relative to working directory"
}
"loc.input.help.data_api_location": "Directory location of the Data API source files relative to working directory",
"loc.input.label.azure_access_token": "Azure Access Token",
"loc.input.help.azure_access_token": "Access token used to authenticate and authorize the deployment",
"loc.input.label.default_hostname": "Default Hostname",
"loc.input.help.default_hostname": "Default Hostname of the app"
}
4 changes: 3 additions & 1 deletion Tasks/AzureStaticWebAppV0/envVarDenylist.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,7 @@
"ROUTES_LOCATION",
"ORIGINAL_PATH",
"DEPLOYMENT_ACTION",
"NUGET_PACKAGES"
"NUGET_PACKAGES",
"AZURE_ACCESS_TOKEN",
"DEFAULT_HOSTNAME"
]
10 changes: 8 additions & 2 deletions Tasks/AzureStaticWebAppV0/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ const routesLocationInputName = 'routes_location';
const buildTimeoutInMinutesInputName = 'build_timeout_in_minutes';
const configFileLocationInputName = 'config_file_location';
const apiTokenInputName = 'azure_static_web_apps_api_token';
const accessTokenInputName = 'azure_access_token';
const defaultHostnameInputName = 'default_hostname';
const deploymentEnvironmentInputName = 'deployment_environment';
const productionBranchInputName = 'production_branch';
const dataApiLocationInputName = 'data_api_location';
Expand Down Expand Up @@ -87,7 +89,9 @@ async function createDockerEnvVarFile(envVarFilePath: string) {
const skipApiBuild: boolean = tl.getBoolInput('skip_api_build', false);
const isStaticExport: boolean = tl.getBoolInput('is_static_export', false);
const apiToken: string = process.env[apiTokenInputName] || tl.getInput(apiTokenInputName, false) || "";

const accessToken: string = process.env[accessTokenInputName] || tl.getInput(accessTokenInputName, false) || "";
const defaultHostname: string = process.env[defaultHostnameInputName] || tl.getInput(defaultHostnameInputName, false) || "";

const systemVerbose = getNullableBooleanFromString(process.env['SYSTEM_DEBUG']);
const inputVerbose = getNullableBooleanFromString(tl.getInput('verbose', false));

Expand All @@ -114,7 +118,9 @@ async function createDockerEnvVarFile(envVarFilePath: string) {
addSystemVariableToString("VERBOSE", verbose.toString());

addInputStringToString("DEPLOYMENT_TOKEN", apiToken, apiTokenInputName);

addInputStringToString("AZURE_ACCESS_TOKEN", accessToken, accessTokenInputName);
addInputStringToString("DEFAULT_HOSTNAME", defaultHostname, defaultHostnameInputName);

process.env['SWA_DEPLOYMENT_CLIENT'] = deploymentClient;
process.env['SWA_WORKING_DIR'] = workingDirectory;
process.env['SWA_WORKSPACE_DIR'] = containerWorkingDir;
Expand Down
78 changes: 39 additions & 39 deletions Tasks/AzureStaticWebAppV0/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 18 additions & 2 deletions Tasks/AzureStaticWebAppV0/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"demands": [],
"version": {
"Major": 0,
"Minor": 246,
"Minor": 247,
"Patch": 0
},
"preview": true,
Expand Down Expand Up @@ -160,6 +160,22 @@
"defaultValue": "",
"required": false,
"helpMarkDown": "Directory location of the Data API source files relative to working directory"
},
{
"name": "azure_access_token",
"type": "string",
"label": "Azure Access Token",
"defaultValue": "",
"required": false,
"helpMarkDown": "Access Token used for deployment. Not required if passed as a variable"
},
{
"name": "default_hostname",
"type": "string",
"label": "Default Hostname",
"defaultValue": "",
"required": false,
"helpMarkDown": "Default hostname for deployment. Not required if passed as an environment variable"
}
],
"execution": {
Expand All @@ -172,4 +188,4 @@
"argumentFormat": ""
}
}
}
}
20 changes: 18 additions & 2 deletions Tasks/AzureStaticWebAppV0/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"demands": [],
"version": {
"Major": 0,
"Minor": 246,
"Minor": 247,
"Patch": 0
},
"preview": true,
Expand Down Expand Up @@ -160,6 +160,22 @@
"defaultValue": "",
"required": false,
"helpMarkDown": "ms-resource:loc.input.help.data_api_location"
},
{
"name": "azure_access_token",
"type": "string",
"label": "ms-resource:loc.input.label.azure_access_token",
"defaultValue": "",
"required": false,
"helpMarkDown": "ms-resource:loc.input.help.azure_access_token"
},
{
"name": "default_hostname",
"type": "string",
"label": "ms-resource:loc.input.label.default_hostname",
"defaultValue": "",
"required": false,
"helpMarkDown": "ms-resource:loc.input.help.default_hostname"
}
],
"execution": {
Expand All @@ -172,4 +188,4 @@
"argumentFormat": ""
}
}
}
}
4 changes: 2 additions & 2 deletions _generated/AzureStaticWebAppV0.versionmap.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Default|0.246.0
Node20_229_8|0.246.1
Default|0.247.0
Node20_229_8|0.247.1
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,9 @@
"loc.input.label.production_branch": "Production Branch",
"loc.input.help.production_branch": "Production branch. When specified and Deployment Environment is empty, deployments from other branches will be preview environments",
"loc.input.label.data_api_location": "Data api location",
"loc.input.help.data_api_location": "Directory location of the Data API source files relative to working directory"
"loc.input.help.data_api_location": "Directory location of the Data API source files relative to working directory",
"loc.input.label.azure_access_token": "Azure Access Token",
"loc.input.help.azure_access_token": "Access Token used for deployment. Not required if passed as a variable",
"loc.input.label.default_hostname": "Default Hostname",
"loc.input.help.default_hostname": "Default hostname for deployment. Not required if passed as an environment variable"
}
4 changes: 3 additions & 1 deletion _generated/AzureStaticWebAppV0/envVarDenylist.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,7 @@
"ROUTES_LOCATION",
"ORIGINAL_PATH",
"DEPLOYMENT_ACTION",
"NUGET_PACKAGES"
"NUGET_PACKAGES",
"AZURE_ACCESS_TOKEN",
"DEFAULT_HOSTNAME"
]
10 changes: 8 additions & 2 deletions _generated/AzureStaticWebAppV0/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ const routesLocationInputName = 'routes_location';
const buildTimeoutInMinutesInputName = 'build_timeout_in_minutes';
const configFileLocationInputName = 'config_file_location';
const apiTokenInputName = 'azure_static_web_apps_api_token';
const accessTokenInputName = 'azure_access_token';
const defaultHostnameInputName = 'default_hostname';
const deploymentEnvironmentInputName = 'deployment_environment';
const productionBranchInputName = 'production_branch';
const dataApiLocationInputName = 'data_api_location';
Expand Down Expand Up @@ -87,7 +89,9 @@ async function createDockerEnvVarFile(envVarFilePath: string) {
const skipApiBuild: boolean = tl.getBoolInput('skip_api_build', false);
const isStaticExport: boolean = tl.getBoolInput('is_static_export', false);
const apiToken: string = process.env[apiTokenInputName] || tl.getInput(apiTokenInputName, false) || "";

const accessToken: string = process.env[accessTokenInputName] || tl.getInput(accessTokenInputName, false) || "";
const defaultHostname: string = process.env[defaultHostnameInputName] || tl.getInput(defaultHostnameInputName, false) || "";

const systemVerbose = getNullableBooleanFromString(process.env['SYSTEM_DEBUG']);
const inputVerbose = getNullableBooleanFromString(tl.getInput('verbose', false));

Expand All @@ -114,7 +118,9 @@ async function createDockerEnvVarFile(envVarFilePath: string) {
addSystemVariableToString("VERBOSE", verbose.toString());

addInputStringToString("DEPLOYMENT_TOKEN", apiToken, apiTokenInputName);

addInputStringToString("AZURE_ACCESS_TOKEN", accessToken, accessTokenInputName);
addInputStringToString("DEFAULT_HOSTNAME", defaultHostname, defaultHostnameInputName);

process.env['SWA_DEPLOYMENT_CLIENT'] = deploymentClient;
process.env['SWA_WORKING_DIR'] = workingDirectory;
process.env['SWA_WORKSPACE_DIR'] = containerWorkingDir;
Expand Down
78 changes: 39 additions & 39 deletions _generated/AzureStaticWebAppV0/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading