Skip to content

Commit

Permalink
Merge pull request #1 from vanyae-cqc/feature/add-destination-path
Browse files Browse the repository at this point in the history
Added destination_path as an argument
  • Loading branch information
vanyae-cqc authored Aug 15, 2022
2 parents fe54245 + f88a4bf commit 83c535c
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ LABEL "com.github.actions.name"="azure-fileshare-upload"
LABEL "com.github.actions.description"="Uploads folders to Azure File Share"
LABEL "com.github.actions.icon"="arrow-up"
LABEL "com.github.actions.color"="green"
LABEL "repository"="https://github.com/cahaseler/azure-fileshare-upload"
LABEL "homepage"="https://github.com/cahaseler/azure-fileshare-upload"
LABEL "maintainer"="Craig Haseler <cahaseler@gmail.com>"
LABEL "repository"="https://github.com/ vanyae-cqc /azure-fileshare-upload"
LABEL "homepage"="https://github.com/ vanyae-cqc /azure-fileshare-upload"
LABEL "maintainer"="Vanya Eccles <vanya.eccles@quantinuum.com>"

ADD entrypoint.sh /entrypoint.sh
RUN chmod +x entrypoint.sh
Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

This action uses the [Azure CLI](https://docs.microsoft.com/en-us/cli/azure/install-azure-cli) to upload a directory of your choice to your Azure File Storage.

It is a fork of https://github.com/cahaseler/azure-fileshare-upload.

## Usage

### Example
Expand All @@ -19,11 +21,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: cahaseler/[email protected]
- uses: vanyae-cqc/[email protected]
with:
account_name: storageaccount
account_key: ${{secrets.ACCOUNT_KEY}}
share_name: azure-fileshare
source_dir: config
destination_path: '/my_fileshare_directory'
cloud: AzureUSGovernment
```
3 changes: 3 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ inputs:
source_dir:
description: "The name of the directory in your Github you want to replace the contents of the fileshare with."
required: true
desination_path:
description: "The destination path in the fileshare to upload to."
required: true
cloud:
description: "If not on the general cloud, use this to specify an alternate cloud such as AzureUSGovernment."
required: false
Expand Down
9 changes: 8 additions & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,16 @@ if [ -z "$INPUT_SOURCE_DIR" ]; then
exit 1
fi

if [ -z "$INPUT_DESTINATION_PATH" ]; then
echo "Destination path is not set. Quitting."
exit 1
fi

if [ -n "$INPUT_CLOUD" ]; then
echo "Setting Azure Cloud to $INPUT_CLOUD"
az cloud set --name $INPUT_CLOUD
fi

az storage file upload-batch --account-name $INPUT_ACCOUNT_NAME --account-key $INPUT_ACCOUNT_KEY --destination $INPUT_SHARE_NAME --source $INPUT_SOURCE_DIR


az storage file upload-batch --account-name $INPUT_ACCOUNT_NAME --account-key $INPUT_ACCOUNT_KEY --destination $INPUT_SHARE_NAME --destination-path $INPUT_DESTINATION_PATH --source $INPUT_SOURCE_DIR

0 comments on commit 83c535c

Please sign in to comment.