Skip to content

Commit 3fd108b

Browse files
authored
Merge pull request #7 from armhil/armhil/switch-ids
Change auth to entra id
2 parents 19bd8ba + 7bb88fe commit 3fd108b

File tree

7 files changed

+803
-39
lines changed

7 files changed

+803
-39
lines changed

.github/workflows/main.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,9 @@ jobs:
4040
- name: Upload Static Content
4141
uses: armhil/azure-blobs-content-uploader@1.0.0
4242
with:
43-
azureBlobConfiguration: ${{ secrets.AZ_BLOB_CONFIGURATION }}
43+
clientId: ${{ secrets.ENTRA_CLIENTID }}
44+
clientSecret: ${{ secrets.ENTRA_CLIENTSECRET }}
45+
tenantId: ${{ secrets.ENTRA_TENANTID }}
46+
storageAccountsList: ${{ secrets.STORAGE_ACCOUNT_LIST }}
47+
containerName: "$web"
4448
directoriesToUpload: '[{"path": "test/integrationtest-directory", "shouldRecurse": "true" }]'

action.yml

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,20 @@
11
name: 'Static Content Uploader for Azure Blobs'
22
description: 'A useful tool for uploading CRA artifacts to Az Blobs'
33
inputs:
4-
azureBlobConfiguration: # Should be a secret value, with connection strings
5-
description: 'Azure blob configuration'
4+
clientId: # Should be a secret value, string
5+
description: 'Entra App App Id'
6+
required: true
7+
clientSecret: # Should be a secret value, string
8+
description: 'Entra App App Id'
9+
required: true
10+
tenantId: # Should be a secret value, with connection strings
11+
description: 'Entra App Tenant Id'
12+
required: true
13+
storageAccountList: # Could be secret but not necessarily
14+
description: 'Storage accounts'
15+
required: true
16+
containerName: # Could be secret but not necessarily
17+
description: 'Container Name'
618
required: true
719
fileTypesToUpload: # We may not want to upload all files
820
description: 'Our static content extensions to Content-Type may be limited for you, use this if you want to extend'
@@ -12,5 +24,5 @@ inputs:
1224
description: 'List of directories to upload, relative paths only'
1325
required: true
1426
runs:
15-
using: 'node16'
27+
using: 'node18'
1628
main: 'dist/index.js'

index.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as core from '@actions/core';
22
import { getFilesForUpload } from './src/file-system-utils';
33
import { uploadAll } from './src/azure-upload-utils';
4-
import { LocalFileMapping, JobParamAzureUploadConfiguration, JobParamDirectoryUpload } from './src/types';
4+
import { LocalFileMapping, EntraAppConfiguration, JobParamDirectoryUpload } from './src/types';
55

66
try {
77
/**
@@ -26,8 +26,16 @@ try {
2626
* { connectionString: "", container: "" }
2727
* ]
2828
*/
29-
const azureBlobConfiguration: JobParamAzureUploadConfiguration = JSON.parse(core.getInput('azureBlobConfiguration'));
30-
uploadAll(azureBlobConfiguration, filesToUpload, fileTypesToUpload);
29+
const entraAppConfiguration: EntraAppConfiguration = {
30+
clientId: core.getInput('clientId'),
31+
clientSecret: core.getInput('clientSecret'),
32+
tenantId: core.getInput('tenantId')
33+
};
34+
35+
const storageAccountList: Array<string> = JSON.parse(core.getInput('storageAccountList'));
36+
const containerName = core.getInput('containerName');
37+
38+
uploadAll(storageAccountList, containerName, entraAppConfiguration, filesToUpload, fileTypesToUpload);
3139
}
3240
catch (error) {
3341
core.setFailed(error.message);

0 commit comments

Comments
 (0)