Skip to content

Commit 284491d

Browse files
committed
Use prebuilt mc binary in place of docker image
Signed-off-by: Kostis Papazafeiropoulos <[email protected]>
1 parent 8494658 commit 284491d

File tree

4 files changed

+68
-87
lines changed

4 files changed

+68
-87
lines changed

.github/workflows/test.yml

Lines changed: 31 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,34 @@ on: push
44

55
jobs:
66
download:
7-
runs-on: self-hosted
8-
steps:
9-
- uses: actions/checkout@v2
10-
- uses: ./
11-
with:
12-
url: https://s3.nubificus.com
13-
access-key: ${{ secrets.AWS_ACCESS_KEY }}
14-
secret-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
15-
local-path: "./"
16-
remote-path: "github/test/test.txt"
7+
runs-on: self-hosted
8+
steps:
9+
- name: Checkout repo
10+
uses: actions/checkout@v4
11+
12+
- name: Test single file download
13+
uses: ./
14+
with:
15+
url: https://s3.nubificus.com
16+
access-key: ${{ secrets.AWS_ACCESS_KEY }}
17+
secret-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
18+
local-path: "./"
19+
remote-path: "github/minio/test1.txt"
20+
21+
- name: Test wildcard with extension download
22+
uses: ./
23+
with:
24+
url: https://s3.nubificus.com
25+
access-key: ${{ secrets.AWS_ACCESS_KEY }}
26+
secret-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
27+
local-path: "./"
28+
remote-path: "github/minio/*.txt"
29+
30+
- name: Test wildcard download
31+
uses: ./
32+
with:
33+
url: https://s3.nubificus.com
34+
access-key: ${{ secrets.AWS_ACCESS_KEY }}
35+
secret-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
36+
local-path: "./"
37+
remote-path: "github/minio/*"

Dockerfile

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

action.yml

Lines changed: 37 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,40 @@ inputs:
2121
required: true
2222

2323
runs:
24-
using: 'docker'
25-
image: 'Dockerfile'
26-
entrypoint: '/entrypoint.sh'
27-
args:
28-
- ${{ inputs.url }}
29-
- ${{ inputs.access-key }}
30-
- ${{ inputs.secret-key }}
31-
- ${{ inputs.local-path }}
32-
- ${{ inputs.remote-path }}
24+
using: composite
25+
steps:
26+
- name: Setup mc
27+
working-directory: /usr/local/bin
28+
run: |
29+
[ -n "$(which mc)" ] && exit 0
30+
arch=$(dpkg --print-architecture | sed 's/armhf/arm/g')
31+
sudo wget --progres=dot:binary \
32+
"https://dl.min.io/client/mc/release/linux-${arch}/mc"
33+
sudo chmod +x mc
34+
shell: bash
35+
36+
- name: Setup s3 alias
37+
run: |
38+
mc alias set s3 "${{ inputs.url }}" \
39+
"${{ inputs.access-key }}" "${{ inputs.secret-key }}"
40+
shell: bash
41+
42+
- name: Download objects
43+
run: |
44+
echo "Will download ${{ inputs.remote-path }} to ${{ inputs.local-path }}"
45+
remote_path=${{ inputs.remote-path }}
46+
if [ "${remote_path#*'*'}" != "$remote_path" ]; then
47+
# Handle remote_files with wildcards
48+
remote_dir=$(dirname "$remote_path")
49+
remote_files=$(basename "$remote_path")
50+
IFS=$'\n'
51+
for p in $(mc find "s3/$remote_dir" \
52+
--maxdepth 2 --name "$remote_files" | sort -u); do
53+
echo "$p"
54+
mc cp -r "$p" "${{ inputs.local-path }}";
55+
done
56+
unset IFS
57+
else
58+
mc cp -r "s3/$remote_path" "${{ inputs.local-path }}"
59+
fi
60+
shell: bash

entrypoint.sh

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

0 commit comments

Comments
 (0)