Skip to content

Commit 2d96d5d

Browse files
authored
Adding AzureStaticWebAppV0 to releases/m183 (#14431)
1 parent 388d1f5 commit 2d96d5d

File tree

10 files changed

+650
-0
lines changed

10 files changed

+650
-0
lines changed

.github/CODEOWNERS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ Tasks/AzureRmWebAppDeploymentV3/ @nadesu @chshrikh @pipeline-environment
7777

7878
Tasks/AzureRmWebAppDeploymentV4/ @nadesu @chshrikh @pipeline-environment-team
7979

80+
Tasks/AzureStaticWebAppV0/ @miwebst @brhopcra
81+
8082
Tasks/AzureWebAppV1/ @nadesu @chshrikh @pipeline-environment-team
8183

8284
Tasks/AzureWebAppContainerV1/ @nadesu @chshrikh @pipeline-environment-team

Tasks/AzureStaticWebAppV0/icon.png

1.08 KB
Loading

Tasks/AzureStaticWebAppV0/icon.svg

Lines changed: 17 additions & 0 deletions
Loading

Tasks/AzureStaticWebAppV0/index.ts

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import path = require('path');
2+
import tl = require('azure-pipelines-task-lib/task');
3+
import trm = require('azure-pipelines-task-lib/toolrunner');
4+
5+
async function run() {
6+
try {
7+
tl.setResourcePath(path.join( __dirname, 'task.json'));
8+
9+
var bash: trm.ToolRunner = tl.tool(tl.which('bash', true));
10+
11+
var scriptPath: string = path.join(__dirname, 'launch-docker.sh');
12+
13+
var workingDirectory: string = path.dirname(scriptPath);
14+
15+
tl.mkdirP(workingDirectory);
16+
tl.cd(workingDirectory);
17+
18+
bash.arg(scriptPath);
19+
20+
bash.line(tl.getInput('args', false));
21+
22+
const deploymentClient = "mcr.microsoft.com/appsvc/staticappsclient:stable";
23+
24+
const appLocation: string = tl.getInput('app_location', false) || "";
25+
const appBuildCommand: string = tl.getInput('app_build_command', false) || "";
26+
const outputLoction: string = tl.getInput('output_location', false) || "";
27+
const apiLocation: string = tl.getInput('api_location', false) || "";
28+
const apiBuildCommand: string = tl.getInput('api_build_command', false) || "";
29+
const routesLocation: string = tl.getInput('routes_location', false) || "";
30+
31+
process.env['SWA_APP_LOCATION'] = appLocation;
32+
process.env['SWA_APP_BUILD_COMMAND'] = appBuildCommand;
33+
process.env['SWA_OUTPUT_LOCATION'] = outputLoction;
34+
process.env['SWA_API_LOCATION'] = apiLocation;
35+
process.env['SWA_API_BUILD_COMMAND'] = apiBuildCommand;
36+
process.env['SWA_ROUTES_LOCATION'] = routesLocation;
37+
process.env['SWA_DEPLOYMENT_CLIENT'] = deploymentClient;
38+
39+
const options = {
40+
failOnStdErr: false,
41+
};
42+
43+
await bash.exec(<any>options);
44+
tl.setResult(tl.TaskResult.Succeeded, null);
45+
}
46+
catch(err) {
47+
tl.setResult(tl.TaskResult.Failed, null);
48+
}
49+
}
50+
51+
run();
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
workspace="/working_dir"
2+
3+
params=()
4+
5+
[[ ! -z "$SWA_APP_LOCATION" ]] && params+=(-e "INPUT_APP_LOCATION=$SWA_APP_LOCATION")
6+
[[ ! -z "$SWA_APP_BUILD_COMMAND" ]] && params+=(-e "INPUT_APP_BUILD_COMMAND=$SWA_APP_BUILD_COMMAND")
7+
[[ ! -z "$SWA_OUTPUT_LOCATION" ]] && params+=(-e "INPUT_OUTPUT_LOCATION=$SWA_OUTPUT_LOCATION")
8+
[[ ! -z "$SWA_API_LOCATION" ]] && params+=(-e "INPUT_API_LOCATION=$SWA_API_LOCATION")
9+
[[ ! -z "$SWA_API_BUILD_COMMAND" ]] && params+=(-e "INPUT_API_BUILD_COMMAND=$SWA_API_BUILD_COMMAND")
10+
[[ ! -z "$SWA_ROUTES_LOCATION" ]] && params+=(-e "INPUT_ROUTES_LOCATION=$SWA_ROUTES_LOCATION")
11+
12+
docker run \
13+
-e INPUT_AZURE_STATIC_WEB_APPS_API_TOKEN="$azure_static_web_apps_api_token" \
14+
-e GITHUB_WORKSPACE=$workspace \
15+
-e DEPLOYMENT_PROVIDER=DevOps \
16+
-e REPOSITORY_URL="$BUILD_REPOSITORY_URI" \
17+
-e IS_PULL_REQUEST=false \
18+
-e BASE_BRANCH="$BUILD_SOURCEBRANCHNAME" \
19+
"${params[@]}" \
20+
-v "$BUILD_SOURCESDIRECTORY:$workspace" \
21+
"$SWA_DEPLOYMENT_CLIENT" \
22+
./bin/staticsites/StaticSitesClient upload

0 commit comments

Comments
 (0)