Skip to content

Commit 81e670e

Browse files
authored
Merge pull request #2 from fixpoint/fix-upload-destination
Fix upload destination
2 parents d9ffdf2 + 14e49d1 commit 81e670e

File tree

2 files changed

+18
-8
lines changed

2 files changed

+18
-8
lines changed

.github/workflows/test.yml

+13-6
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,33 @@ jobs:
1212
- run: |
1313
mkdir -p path/to/artifact1
1414
mkdir -p path/to/artifact2
15-
echo hello > path/to/artifact1/world.txt
16-
echo hello > path/to/artifact2/world.txt
15+
echo hello > path/to/artifact1/hello.txt
16+
echo world > path/to/artifact2/world.txt
1717
1818
- name: Basic usage
1919
uses: ./
2020
with:
2121
connection-string: ${{ secrets.AZURE_STORAGE_CONNECTION_STRING }}
22-
name: 'azblob-upload-artifact'
22+
name: 'azblob-upload-artifact1'
2323
path: 'README.md'
2424

2525
- name: Upload with path (file)
2626
uses: ./
2727
with:
2828
connection-string: ${{ secrets.AZURE_STORAGE_CONNECTION_STRING }}
29-
name: 'azblob-upload-artifact'
30-
path: 'path/to/artifact1/world.txt'
29+
name: 'azblob-upload-artifact2'
30+
path: 'path/to/artifact1/hello.txt'
3131

3232
- name: Upload with path (directory)
3333
uses: ./
3434
with:
3535
connection-string: ${{ secrets.AZURE_STORAGE_CONNECTION_STRING }}
36-
name: 'azblob-upload-artifact'
36+
name: 'azblob-upload-artifact3'
3737
path: 'path/to/artifact2'
38+
39+
- name: Upload (overwrite)
40+
uses: ./
41+
with:
42+
connection-string: ${{ secrets.AZURE_STORAGE_CONNECTION_STRING }}
43+
name: 'azblob-upload-artifact3'
44+
path: 'path/to/artifact1'

entrypoint.sh

+5-2
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,13 @@ AZ_PATH=$1; shift
66
# Create a specified container
77
az storage container create -n "$AZ_CONTAINER"
88

9+
# Remove resources in the directory
10+
az storage blob delete-batch -s "$AZ_CONTAINER" --pattern "$AZ_NAME/*"
11+
912
if [[ -d "$AZ_PATH" ]]; then
1013
# Directory upload
11-
az storage blob upload-batch -d "$AZ_CONTAINER" -s "$AZ_PATH" --destination-path "$AZ_NAME/$AZ_PATH"
14+
az storage blob upload-batch -d "$AZ_CONTAINER" -s "$AZ_PATH" --destination-path "$AZ_NAME"
1215
else
1316
# File upload
14-
az storage blob upload -c "$AZ_CONTAINER" -n "$AZ_NAME/$AZ_PATH" -f "$AZ_PATH"
17+
az storage blob upload -c "$AZ_CONTAINER" -n "$AZ_NAME/$(basename $AZ_PATH)" -f "$AZ_PATH"
1518
fi

0 commit comments

Comments
 (0)