Skip to content

Commit

Permalink
Use prebuilt mc binary in place of docker image
Browse files Browse the repository at this point in the history
Signed-off-by: Kostis Papazafeiropoulos <[email protected]>
  • Loading branch information
papazof committed Sep 27, 2024
1 parent 8494658 commit 89bbd3e
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 77 deletions.
5 changes: 0 additions & 5 deletions Dockerfile

This file was deleted.

45 changes: 36 additions & 9 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,39 @@ inputs:
required: true

runs:
using: 'docker'
image: 'Dockerfile'
entrypoint: '/entrypoint.sh'
args:
- ${{ inputs.url }}
- ${{ inputs.access-key }}
- ${{ inputs.secret-key }}
- ${{ inputs.local-path }}
- ${{ inputs.remote-path }}
using: composite
steps:
- name: Setup mc
working-directory: /usr/local/bin
run: |
[ -n "$(which mc)" ] && exit 0
arch=$(dpkg --print-architecture)
sudo wget --progres=dot:mega \
"https://dl.min.io/client/mc/release/linux-${arch}/mc"
sudo chmod +x mc
shell: bash

- name: Setup s3 alias
run: |
mc alias set s3 "${{ inputs.url }}" \
"${{ inputs.access-key }}" "${{ inputs.secret-key }}"
shell: bash

- name: Download objects
run: |
remote_path=${{ inputs.remote-path }}
if [ "${remote_path#*'*'}" != "$remote_path" ]; then
# Handle remote_dir with wildcard
remote_dir=$(dirname "$remote_path")
remote_files=$(basename "$remote_path")
path_depth=$(echo "$remote_dir" | awk -F"/" '{print NF-1}')
IFS=$'\n'
for p in $(mc find "s3/$remote_dir" \
--name "$remote_files" --maxdepth "$path_depth"); do
mc cp -r "$p" "${{ inputs.local-path }}";
done
unset IFS
else
mc cp -r "s3/$remote_path ${{ inputs.local-path }}"
fi
shell: bash
63 changes: 0 additions & 63 deletions entrypoint.sh

This file was deleted.

0 comments on commit 89bbd3e

Please sign in to comment.