Skip to content

Commit 3aede08

Browse files
committed
WIP
1 parent 052c24f commit 3aede08

14 files changed

+2627
-294
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules/**/*

index.js

Lines changed: 0 additions & 33 deletions
This file was deleted.

index.ts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
const core = require('@actions/core');
2+
import { getFilesForUpload } from './src/file-system-utils';
3+
import { uploadAll } from './src/azure-upload-utils';
4+
import { LocalFileMapping, JobParamAzureUploadConfiguration, JobParamDirectoryUpload } from './src/types';
5+
6+
try {
7+
/**
8+
* File types to upload should look like
9+
* { ".html": "text/html" }
10+
*/
11+
const fileTypesToUpload = JSON.parse(core.getInput('fileTypesToUpload'));
12+
/**
13+
* Directories to upload should look like
14+
* [
15+
* { path: "", shouldRecurse: "", baseContainerPath: "" }
16+
* ]
17+
*/
18+
const directoriesToUpload: JobParamDirectoryUpload = JSON.parse(core.getInput('directoriesToUpload')) || [];
19+
let filesToUpload: Array<LocalFileMapping> = [];
20+
directoriesToUpload.forEach(t => {
21+
filesToUpload = filesToUpload.concat(getFilesForUpload(t.directoryToUpload, t.shouldRecurse, t.baseContainerPath, Object.keys(fileTypesToUpload)));
22+
});
23+
/**
24+
* Azure Blob Configurations should look like
25+
* [
26+
* { connectionString: "", container: "" }
27+
* ]
28+
*/
29+
const azureBlobConfiguration: JobParamAzureUploadConfiguration = JSON.parse(core.getInput('azureBlobConfiguration'));
30+
uploadAll(azureBlobConfiguration, filesToUpload, fileTypesToUpload);
31+
}
32+
catch (error) {
33+
core.setFailed(error.message);
34+
}

0 commit comments

Comments
 (0)